Hctr3

Struct Hctr3 

Source
pub struct Hctr3<Aes: AesCipher> { /* private fields */ }
Expand description

Generic HCTR3 cipher parameterized by AES key size.

Implementations§

Source§

impl<Aes: AesCipher> Hctr3<Aes>

Source

pub const KEY_LENGTH: usize = Aes::KEY_LEN

Encryption key length in bytes.

Source

pub const BLOCK_LENGTH: usize = BLOCK_LENGTH

AES block length in bytes (always 16).

Source

pub const MIN_INPUT_LENGTH: usize = BLOCK_LENGTH

Minimum input length in bytes.

Source

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

Initialize HCTR3 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 to ciphertext using HCTR3.

Source

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

Decrypt ciphertext to plaintext using HCTR3.

Auto Trait Implementations§

§

impl<Aes> Freeze for Hctr3<Aes>
where Aes: Freeze, <Aes as AesCipher>::Dec: Freeze,

§

impl<Aes> RefUnwindSafe for Hctr3<Aes>
where Aes: RefUnwindSafe, <Aes as AesCipher>::Dec: RefUnwindSafe,

§

impl<Aes> Send for Hctr3<Aes>
where Aes: Send, <Aes as AesCipher>::Dec: Send,

§

impl<Aes> Sync for Hctr3<Aes>
where Aes: Sync, <Aes as AesCipher>::Dec: Sync,

§

impl<Aes> Unpin for Hctr3<Aes>
where Aes: Unpin, <Aes as AesCipher>::Dec: Unpin,

§

impl<Aes> UnwindSafe for Hctr3<Aes>
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.