#crypto

no-std binary-ff1

Optimized Rust implementation of FF1 encryption with radix 2

2 unstable releases

0.2.0 Aug 1, 2021
0.1.0 Apr 9, 2020

#425 in #crypto

Download history 59/week @ 2022-06-13 54/week @ 2022-06-20 143/week @ 2022-06-27 145/week @ 2022-07-04 30/week @ 2022-07-11 106/week @ 2022-07-18 136/week @ 2022-07-25 63/week @ 2022-08-01 164/week @ 2022-08-08 205/week @ 2022-08-15 210/week @ 2022-08-22 182/week @ 2022-08-29 196/week @ 2022-09-05 138/week @ 2022-09-12 225/week @ 2022-09-19 55/week @ 2022-09-26

614 downloads per month

MIT/Apache

28KB
578 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

# use aes::{
#     cipher::{generic_array::GenericArray, NewBlockCipher},
#     Aes256,
# };
# use binary_ff1::BinaryFF1;
#
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

~285KB