aboutsummaryrefslogtreecommitdiff
path: root/crates/rsli/src/compress/xor.rs
diff options
context:
space:
mode:
authorValentin Popov <valentin@popov.link>2026-06-22 12:12:27 +0300
committerValentin Popov <valentin@popov.link>2026-06-22 12:13:32 +0300
commitd0bdbaa1ed76dfbf3211bb43eee48c49cc4fd448 (patch)
treea0bd35c3940be62a5b5de1acc2366af377ffd181 /crates/rsli/src/compress/xor.rs
parent7416fdc7e9a48837fff5056e6dc8d0774e90964b (diff)
downloadfparkan-d0bdbaa1ed76dfbf3211bb43eee48c49cc4fd448.tar.xz
fparkan-d0bdbaa1ed76dfbf3211bb43eee48c49cc4fd448.zip
feat: implement FParkan architecture foundation
Add the modular fparkan workspace, domain crates, adapters, apps, xtask policy/CI, acceptance evidence, and licensed corpus gates for the macOS-focused roadmap foundation.
Diffstat (limited to 'crates/rsli/src/compress/xor.rs')
-rw-r--r--crates/rsli/src/compress/xor.rs29
1 files changed, 0 insertions, 29 deletions
diff --git a/crates/rsli/src/compress/xor.rs b/crates/rsli/src/compress/xor.rs
deleted file mode 100644
index c4c3d7d..0000000
--- a/crates/rsli/src/compress/xor.rs
+++ /dev/null
@@ -1,29 +0,0 @@
-/// XOR cipher state for RsLi format
-pub struct XorState {
- lo: u8,
- hi: u8,
-}
-
-impl XorState {
- /// Create new XOR state from 16-bit key
- pub fn new(key16: u16) -> Self {
- Self {
- lo: (key16 & 0xFF) as u8,
- hi: ((key16 >> 8) & 0xFF) as u8,
- }
- }
-
- /// Decrypt a single byte and update state
- pub fn decrypt_byte(&mut self, encrypted: u8) -> u8 {
- self.lo = self.hi ^ self.lo.wrapping_shl(1);
- let decrypted = encrypted ^ self.lo;
- self.hi = self.lo ^ (self.hi >> 1);
- decrypted
- }
-}
-
-/// Decrypt entire buffer with XOR stream cipher
-pub fn xor_stream(data: &[u8], key16: u16) -> Vec<u8> {
- let mut state = XorState::new(key16);
- data.iter().map(|&b| state.decrypt_byte(b)).collect()
-}