pub struct Lioness<H: KeySizeUser + OutputSizeUser, S: KeySizeUser + IvSizeUser, B>where
H::OutputSize: IsEqual<S::KeySize, Output = B1>,
H::KeySize: IsEqual<S::KeySize, Output = B1>,
B: IsGreater<<S as KeySizeUser>::KeySize, Output = B1> + ArrayLength<u8>,{ /* private fields */ }
Expand description
Implementation of Lioness wide-block cipher over a keyed Digest
and a StreamCipher
.
§Requirements
- The output size of the
Digest
H
must match the key size of theStreamCipher
. - The key size of the keyed digest
H
must be equal to the key size of theStreamCipher
. - The block size
B
can be arbitrary but must be strictly greater than the key size of theStreamCipher
. - However, for cryptographic security,
B
must be at least twice the key size of theStreamCipher
.
The key size of the Lioness cipher is 4-times the size of StreamCipher
’s
key.
The IV size of the Lioness cipher is 2-times the size of the StreamCipher
’s
IV size.
Implementations§
Source§impl<H: Digest + KeyInit, S: StreamCipher + KeyIvInit, B> Lioness<H, S, B>where
H::OutputSize: IsEqual<<S as KeySizeUser>::KeySize, Output = B1> + Mul<U4>,
H::KeySize: IsEqual<S::KeySize, Output = B1>,
B: IsGreater<<S as KeySizeUser>::KeySize, Output = B1> + Sub<<S as KeySizeUser>::KeySize> + ArrayLength<u8>,
<B as Sub<<S as KeySizeUser>::KeySize>>::Output: ArrayLength<u8>,
<S as IvSizeUser>::IvSize: Mul<U2>,
<H::OutputSize as Mul<U4>>::Output: ArrayLength<u8>,
<<S as IvSizeUser>::IvSize as Mul<U2>>::Output: ArrayLength<u8>,
impl<H: Digest + KeyInit, S: StreamCipher + KeyIvInit, B> Lioness<H, S, B>where
H::OutputSize: IsEqual<<S as KeySizeUser>::KeySize, Output = B1> + Mul<U4>,
H::KeySize: IsEqual<S::KeySize, Output = B1>,
B: IsGreater<<S as KeySizeUser>::KeySize, Output = B1> + Sub<<S as KeySizeUser>::KeySize> + ArrayLength<u8>,
<B as Sub<<S as KeySizeUser>::KeySize>>::Output: ArrayLength<u8>,
<S as IvSizeUser>::IvSize: Mul<U2>,
<H::OutputSize as Mul<U4>>::Output: ArrayLength<u8>,
<<S as IvSizeUser>::IvSize as Mul<U2>>::Output: ArrayLength<u8>,
Sourcepub fn encrypt_block(&self, block: InOut<'_, '_, Block<Self>>)
pub fn encrypt_block(&self, block: InOut<'_, '_, Block<Self>>)
Performs encryption of the given block
.
Sourcepub fn decrypt_block(&self, block: InOut<'_, '_, Block<Self>>)
pub fn decrypt_block(&self, block: InOut<'_, '_, Block<Self>>)
Performs decryption of the given block
.
Trait Implementations§
Source§impl<H: KeySizeUser + OutputSizeUser + AlgorithmName, S: AlgorithmName + KeySizeUser + IvSizeUser, B> AlgorithmName for Lioness<H, S, B>where
H::OutputSize: IsEqual<<S as KeySizeUser>::KeySize, Output = B1>,
H::KeySize: IsEqual<S::KeySize, Output = B1>,
B: IsGreater<<S as KeySizeUser>::KeySize, Output = B1> + ArrayLength<u8>,
impl<H: KeySizeUser + OutputSizeUser + AlgorithmName, S: AlgorithmName + KeySizeUser + IvSizeUser, B> AlgorithmName for Lioness<H, S, B>where
H::OutputSize: IsEqual<<S as KeySizeUser>::KeySize, Output = B1>,
H::KeySize: IsEqual<S::KeySize, Output = B1>,
B: IsGreater<<S as KeySizeUser>::KeySize, Output = B1> + ArrayLength<u8>,
Source§fn write_alg_name(f: &mut Formatter<'_>) -> Result
fn write_alg_name(f: &mut Formatter<'_>) -> Result
Write algorithm name into
f
.Source§impl<H: KeySizeUser + OutputSizeUser, S: KeySizeUser + IvSizeUser, B> BlockSizeUser for Lioness<H, S, B>where
H::OutputSize: IsEqual<S::KeySize, Output = B1> + Mul<U4>,
H::KeySize: IsEqual<S::KeySize, Output = B1>,
B: IsGreater<<S as KeySizeUser>::KeySize, Output = B1> + ArrayLength<u8>,
S::IvSize: Mul<U2>,
<H::OutputSize as Mul<U4>>::Output: ArrayLength<u8>,
<S::IvSize as Mul<U2>>::Output: ArrayLength<u8>,
impl<H: KeySizeUser + OutputSizeUser, S: KeySizeUser + IvSizeUser, B> BlockSizeUser for Lioness<H, S, B>where
H::OutputSize: IsEqual<S::KeySize, Output = B1> + Mul<U4>,
H::KeySize: IsEqual<S::KeySize, Output = B1>,
B: IsGreater<<S as KeySizeUser>::KeySize, Output = B1> + ArrayLength<u8>,
S::IvSize: Mul<U2>,
<H::OutputSize as Mul<U4>>::Output: ArrayLength<u8>,
<S::IvSize as Mul<U2>>::Output: ArrayLength<u8>,
Source§impl<H: Clone + KeySizeUser + OutputSizeUser, S: Clone + KeySizeUser + IvSizeUser, B> Clone for Lioness<H, S, B>
impl<H: Clone + KeySizeUser + OutputSizeUser, S: Clone + KeySizeUser + IvSizeUser, B> Clone for Lioness<H, S, B>
Source§impl<H: KeySizeUser + OutputSizeUser, S: KeySizeUser + IvSizeUser, B> Drop for Lioness<H, S, B>
impl<H: KeySizeUser + OutputSizeUser, S: KeySizeUser + IvSizeUser, B> Drop for Lioness<H, S, B>
Source§impl<H: KeySizeUser + OutputSizeUser, S: KeySizeUser + IvSizeUser, B> IvSizeUser for Lioness<H, S, B>
impl<H: KeySizeUser + OutputSizeUser, S: KeySizeUser + IvSizeUser, B> IvSizeUser for Lioness<H, S, B>
Source§impl<H: KeySizeUser + OutputSizeUser, S: KeySizeUser + IvSizeUser, B> KeyIvInit for Lioness<H, S, B>where
H::OutputSize: IsEqual<S::KeySize, Output = B1> + Mul<U4>,
H::KeySize: IsEqual<S::KeySize, Output = B1>,
B: IsGreater<<S as KeySizeUser>::KeySize, Output = B1> + ArrayLength<u8>,
S::IvSize: Mul<U2>,
<H::OutputSize as Mul<U4>>::Output: ArrayLength<u8>,
<S::IvSize as Mul<U2>>::Output: ArrayLength<u8>,
impl<H: KeySizeUser + OutputSizeUser, S: KeySizeUser + IvSizeUser, B> KeyIvInit for Lioness<H, S, B>where
H::OutputSize: IsEqual<S::KeySize, Output = B1> + Mul<U4>,
H::KeySize: IsEqual<S::KeySize, Output = B1>,
B: IsGreater<<S as KeySizeUser>::KeySize, Output = B1> + ArrayLength<u8>,
S::IvSize: Mul<U2>,
<H::OutputSize as Mul<U4>>::Output: ArrayLength<u8>,
<S::IvSize as Mul<U2>>::Output: ArrayLength<u8>,
Source§fn new(key: &Key<Self>, iv: &Iv<Self>) -> Self
fn new(key: &Key<Self>, iv: &Iv<Self>) -> Self
Create new value from fixed length key and nonce.
§fn new_from_slices(key: &[u8], iv: &[u8]) -> Result<Self, InvalidLength>
fn new_from_slices(key: &[u8], iv: &[u8]) -> Result<Self, InvalidLength>
Create new value from variable length key and nonce.
§fn generate_key(
rng: impl CryptoRng + RngCore,
) -> GenericArray<u8, Self::KeySize>
fn generate_key( rng: impl CryptoRng + RngCore, ) -> GenericArray<u8, Self::KeySize>
Generate random key using the provided
CryptoRng
.Source§impl<H: KeySizeUser + OutputSizeUser, S: KeySizeUser + IvSizeUser, B> KeySizeUser for Lioness<H, S, B>
impl<H: KeySizeUser + OutputSizeUser, S: KeySizeUser + IvSizeUser, B> KeySizeUser for Lioness<H, S, B>
Source§impl<H: Digest + KeyInit, S: StreamCipher + KeyIvInit, B> PRP for Lioness<H, S, B>where
H::OutputSize: IsEqual<<S as KeySizeUser>::KeySize, Output = B1> + Mul<U4>,
H::KeySize: IsEqual<S::KeySize, Output = B1>,
B: IsGreater<<S as KeySizeUser>::KeySize, Output = B1> + Sub<<S as KeySizeUser>::KeySize> + ArrayLength<u8>,
<B as Sub<<S as KeySizeUser>::KeySize>>::Output: ArrayLength<u8>,
<S as IvSizeUser>::IvSize: Mul<U2>,
<H::OutputSize as Mul<U4>>::Output: ArrayLength<u8>,
<<S as IvSizeUser>::IvSize as Mul<U2>>::Output: ArrayLength<u8>,
impl<H: Digest + KeyInit, S: StreamCipher + KeyIvInit, B> PRP for Lioness<H, S, B>where
H::OutputSize: IsEqual<<S as KeySizeUser>::KeySize, Output = B1> + Mul<U4>,
H::KeySize: IsEqual<S::KeySize, Output = B1>,
B: IsGreater<<S as KeySizeUser>::KeySize, Output = B1> + Sub<<S as KeySizeUser>::KeySize> + ArrayLength<u8>,
<B as Sub<<S as KeySizeUser>::KeySize>>::Output: ArrayLength<u8>,
<S as IvSizeUser>::IvSize: Mul<U2>,
<H::OutputSize as Mul<U4>>::Output: ArrayLength<u8>,
<<S as IvSizeUser>::IvSize as Mul<U2>>::Output: ArrayLength<u8>,
Auto Trait Implementations§
impl<H, S, B> Freeze for Lioness<H, S, B>where
<<S as KeySizeUser>::KeySize as ArrayLength<u8>>::ArrayType: Freeze,
<<H as KeySizeUser>::KeySize as ArrayLength<u8>>::ArrayType: Freeze,
<<S as IvSizeUser>::IvSize as ArrayLength<u8>>::ArrayType: Freeze,
impl<H, S, B> RefUnwindSafe for Lioness<H, S, B>where
<<S as KeySizeUser>::KeySize as ArrayLength<u8>>::ArrayType: RefUnwindSafe,
<<H as KeySizeUser>::KeySize as ArrayLength<u8>>::ArrayType: RefUnwindSafe,
<<S as IvSizeUser>::IvSize as ArrayLength<u8>>::ArrayType: RefUnwindSafe,
H: RefUnwindSafe,
S: RefUnwindSafe,
B: RefUnwindSafe,
impl<H, S, B> Send for Lioness<H, S, B>
impl<H, S, B> Sync for Lioness<H, S, B>
impl<H, S, B> Unpin for Lioness<H, S, B>where
<<S as KeySizeUser>::KeySize as ArrayLength<u8>>::ArrayType: Unpin,
<<H as KeySizeUser>::KeySize as ArrayLength<u8>>::ArrayType: Unpin,
<<S as IvSizeUser>::IvSize as ArrayLength<u8>>::ArrayType: Unpin,
H: Unpin,
S: Unpin,
B: Unpin,
impl<H, S, B> UnwindSafe for Lioness<H, S, B>where
<<S as KeySizeUser>::KeySize as ArrayLength<u8>>::ArrayType: UnwindSafe,
<<H as KeySizeUser>::KeySize as ArrayLength<u8>>::ArrayType: UnwindSafe,
<<S as IvSizeUser>::IvSize as ArrayLength<u8>>::ArrayType: UnwindSafe,
H: UnwindSafe,
S: UnwindSafe,
B: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more