Struct aead::stream::StreamLE31
source · [−]pub struct StreamLE31<A> where
A: AeadInPlace,
A::NonceSize: Sub<U4>,
<<A as AeadCore>::NonceSize as Sub<U4>>::Output: ArrayLength<u8>, { /* private fields */ }
stream
only.Expand description
STREAM as instantiated with a 31-bit little endian counter and 1-bit “last block” flag stored as the most significant bit of the counter when interpreted as a 32-bit integer.
The 31-bit + 1-bit value is stored as the last 4 bytes of the AEAD nonce.
Trait Implementations
sourceimpl<A> NewStream<A> for StreamLE31<A> where
A: AeadInPlace,
A::NonceSize: Sub<U4>,
<<A as AeadCore>::NonceSize as Sub<U4>>::Output: ArrayLength<u8>,
impl<A> NewStream<A> for StreamLE31<A> where
A: AeadInPlace,
A::NonceSize: Sub<U4>,
<<A as AeadCore>::NonceSize as Sub<U4>>::Output: ArrayLength<u8>,
sourceimpl<A> StreamPrimitive<A> for StreamLE31<A> where
A: AeadInPlace,
A::NonceSize: Sub<U4>,
<<A as AeadCore>::NonceSize as Sub<U4>>::Output: ArrayLength<u8>,
impl<A> StreamPrimitive<A> for StreamLE31<A> where
A: AeadInPlace,
A::NonceSize: Sub<U4>,
<<A as AeadCore>::NonceSize as Sub<U4>>::Output: ArrayLength<u8>,
type NonceOverhead = UInt<UInt<UInt<UTerm, B1>, B0>, B0>
type NonceOverhead = UInt<UInt<UInt<UTerm, B1>, B0>, B0>
Number of bytes this STREAM primitive requires from the nonce.
sourceconst COUNTER_INCR: u32 = 1u32
const COUNTER_INCR: u32 = 1u32
Value to use when incrementing the STREAM counter (i.e. one)
sourceconst COUNTER_MAX: u32 = 268_435_455u32
const COUNTER_MAX: u32 = 268_435_455u32
Maximum value of the STREAM counter.
sourcefn encrypt_in_place(
&self,
position: u32,
last_block: bool,
associated_data: &[u8],
buffer: &mut dyn Buffer
) -> Result<()>
fn encrypt_in_place(
&self,
position: u32,
last_block: bool,
associated_data: &[u8],
buffer: &mut dyn Buffer
) -> Result<()>
Encrypt an AEAD message in-place at the given position in the STREAM.
sourcefn decrypt_in_place(
&self,
position: Self::Counter,
last_block: bool,
associated_data: &[u8],
buffer: &mut dyn Buffer
) -> Result<()>
fn decrypt_in_place(
&self,
position: Self::Counter,
last_block: bool,
associated_data: &[u8],
buffer: &mut dyn Buffer
) -> Result<()>
Decrypt an AEAD message in-place at the given position in the STREAM.
sourcefn encrypt<'msg, 'aad>(
&self,
position: Self::Counter,
last_block: bool,
plaintext: impl Into<Payload<'msg, 'aad>>
) -> Result<Vec<u8>>
fn encrypt<'msg, 'aad>(
&self,
position: Self::Counter,
last_block: bool,
plaintext: impl Into<Payload<'msg, 'aad>>
) -> Result<Vec<u8>>
alloc
only.Encrypt the given plaintext payload, and return the resulting ciphertext as a vector of bytes. Read more
sourcefn decrypt<'msg, 'aad>(
&self,
position: Self::Counter,
last_block: bool,
ciphertext: impl Into<Payload<'msg, 'aad>>
) -> Result<Vec<u8>>
fn decrypt<'msg, 'aad>(
&self,
position: Self::Counter,
last_block: bool,
ciphertext: impl Into<Payload<'msg, 'aad>>
) -> Result<Vec<u8>>
alloc
only.Decrypt the given ciphertext slice, and return the resulting plaintext as a vector of bytes. Read more
Auto Trait Implementations
impl<A> RefUnwindSafe for StreamLE31<A> where
A: RefUnwindSafe,
<<<A as AeadCore>::NonceSize as Sub<UInt<UInt<UInt<UTerm, B1>, B0>, B0>>>::Output as ArrayLength<u8>>::ArrayType: RefUnwindSafe,
impl<A> Send for StreamLE31<A> where
A: Send,
impl<A> Sync for StreamLE31<A> where
A: Sync,
impl<A> Unpin for StreamLE31<A> where
A: Unpin,
<<<A as AeadCore>::NonceSize as Sub<UInt<UInt<UInt<UTerm, B1>, B0>, B0>>>::Output as ArrayLength<u8>>::ArrayType: Unpin,
impl<A> UnwindSafe for StreamLE31<A> where
A: UnwindSafe,
<<<A as AeadCore>::NonceSize as Sub<UInt<UInt<UInt<UTerm, B1>, B0>, B0>>>::Output as ArrayLength<u8>>::ArrayType: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more