feistel 0.1.0

Generic Feistel Cipher
Documentation
  • Coverage
  • 100%
    28 out of 28 items documented1 out of 6 items with examples
  • Size
  • Source code size: 30.08 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 560.08 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 12s Average build duration of successful builds.
  • all releases: 12s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • parrrate/feistel
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • afeistel github:parrrate:pub

Generic implementation of a Feistel Cipher

let network = key
    .chunks_exact(4)
    .map(|chunk| {
        move |half: &XorArray<u8, ConstArrayLength<32>>| {
            let mut hasher = Sha256::new();
            hasher.update(half);
            hasher.update(chunk);
            let value: [u8; 32] = hasher.finalize().into();
            XorArray(value.into())
        }
    })
    .feistel_symmetric();
let original = [0; 64].into();
let encrypted = network.clone().array_encrypt(original);
assert_ne!(original, encrypted);
let decrypted = network.clone().array_decrypt(encrypted);
assert_eq!(original, decrypted);