Struct binary_ff1::BinaryFF1 [−][src]
pub struct BinaryFF1<'a, C: BlockEncrypt> { /* fields omitted */ }
Expand description
A struct for performing FF1 encryption in radix 2.
The block cipher must have a 16 byte block size and should be AES-128, AES-192, or AES-256.
Implementations
impl<'a, C> BinaryFF1<'a, C> where
C: BlockEncrypt<BlockSize = U16>,
C::ParBlocks: ArrayLength<GenericArray<u8, U16>>,
impl<'a, C> BinaryFF1<'a, C> where
C: BlockEncrypt<BlockSize = U16>,
C::ParBlocks: ArrayLength<GenericArray<u8, U16>>,
Creates an BinaryFF1
instance for a given block cipher, input
length, and tweak. The scratch buffer must be at least len + 1
bytes.
Errors
Returns Error::ScratchTooSmall
if the scratch buffer is too small.
Examples
let mut scratch = vec![0; 128]; assert!(BinaryFF1::new(&cipher, 126, &tweak, &mut scratch).is_ok()); assert!(BinaryFF1::new(&cipher, 127, &tweak, &mut scratch).is_ok()); // Scratch buffer must be at least len + 1 bytes assert_eq!( BinaryFF1::new(&cipher, 128, &tweak, &mut scratch).err(), Some(Error::ScratchTooSmall) );
Encrypts the given plaintext.
Errors
Returns Error::InvalidInputLength
if the length of x
is not the
same as the input length defined in this BinaryFF1
structure.