0.1.0 |
|
---|
#5 in #ff1
29KB
565 lines
binary-ff1
Optimized Rust implementation of FF1 encryption with radix 2, specified in NIST Special Publication 800-38G.
lib.rs
:
Optimized Rust implementation of FF1 encryption with radix 2, specified in NIST Special Publication 800-38G.
Example
#
const KEY: [u8; 32] = [0; 32];
const LEN: usize = 3;
let cipher = Aes256::new(GenericArray::from_slice(&KEY));
let mut scratch = [0; LEN + 1];
let mut ff1 = BinaryFF1::new(&cipher, LEN, &[], &mut scratch).unwrap();
let mut x: [u8; LEN] = [0xAB, 0xCD, 0xEF];
ff1.encrypt(&mut x).unwrap();
assert_eq!(x, [0x75, 0xFB, 0x62]);
ff1.decrypt(&mut x).unwrap();
assert_eq!(x, [0xAB, 0xCD, 0xEF]);
Dependencies
~325KB