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

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.

Decrypts the given ciphertext.

Errors

Returns Error::InvalidInputLength if the length of x is not the same as the input length defined in this BinaryFF1 structure.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.