Hctr3Fp

Struct Hctr3Fp 

Source
pub struct Hctr3Fp<Aes: AesCipher, const RADIX: u16> { /* private fields */ }
Expand description

Generic HCTR3+FP cipher.

Implementations§

Source§

impl<Aes: AesCipher, const RADIX: u16> Hctr3Fp<Aes, RADIX>

Source

pub const FIRST_BLOCK_LENGTH: usize

First block length in digits (radix-dependent).

Source

pub const MIN_MESSAGE_LENGTH: usize = Self::FIRST_BLOCK_LENGTH

Minimum message length in digits (same as first_block_length).

Source

pub const BLOCK_LENGTH: usize = BLOCK_LENGTH

AES block length in bytes (always 16).

Source

pub fn new(key: &[u8]) -> Self

Initialize HCTR3+FP cipher state from an encryption key.

Derives a secondary authentication key (Ke) from the encryption key for the two-key construction.

Source

pub fn encrypt( &self, plaintext: &[u8], tweak: &[u8], ciphertext: &mut [u8], ) -> Result<(), Error>

Encrypt plaintext digits to ciphertext digits using HCTR3+FP.

All input digits must be in range [0, RADIX). Output will also be in this range.

Source

pub fn decrypt( &self, ciphertext: &[u8], tweak: &[u8], plaintext: &mut [u8], ) -> Result<(), Error>

Decrypt ciphertext digits to plaintext digits using HCTR3+FP.

Auto Trait Implementations§

§

impl<Aes, const RADIX: u16> Freeze for Hctr3Fp<Aes, RADIX>
where Aes: Freeze, <Aes as AesCipher>::Dec: Freeze,

§

impl<Aes, const RADIX: u16> RefUnwindSafe for Hctr3Fp<Aes, RADIX>
where Aes: RefUnwindSafe, <Aes as AesCipher>::Dec: RefUnwindSafe,

§

impl<Aes, const RADIX: u16> Send for Hctr3Fp<Aes, RADIX>
where Aes: Send, <Aes as AesCipher>::Dec: Send,

§

impl<Aes, const RADIX: u16> Sync for Hctr3Fp<Aes, RADIX>
where Aes: Sync, <Aes as AesCipher>::Dec: Sync,

§

impl<Aes, const RADIX: u16> Unpin for Hctr3Fp<Aes, RADIX>
where Aes: Unpin, <Aes as AesCipher>::Dec: Unpin,

§

impl<Aes, const RADIX: u16> UnwindSafe for Hctr3Fp<Aes, RADIX>
where Aes: UnwindSafe, <Aes as AesCipher>::Dec: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.