Lioness

Struct Lioness 

Source
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 the StreamCipher.
  • The key size of the keyed digest H must be equal to the key size of the StreamCipher.
  • The block size B can be arbitrary but must be strictly greater than the key size of the StreamCipher.
  • However, for cryptographic security, B must be at least twice the key size of the StreamCipher.

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>,

Source

pub fn encrypt_block(&self, block: InOut<'_, '_, Block<Self>>)

Performs encryption of the given block.

Source

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>,

Source§

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>,

Source§

type BlockSize = B

Size of the block in bytes.
§

fn block_size() -> usize

Return block size in bytes.
Source§

impl<H: Clone + KeySizeUser + OutputSizeUser, S: Clone + KeySizeUser + IvSizeUser, B> Clone for Lioness<H, S, B>
where H::OutputSize: IsEqual<S::KeySize, Output = B1>, H::KeySize: IsEqual<S::KeySize, Output = B1> + Clone, B: IsGreater<<S as KeySizeUser>::KeySize, Output = B1> + Clone + ArrayLength<u8>, S::KeySize: Clone, S::IvSize: Clone,

Source§

fn clone(&self) -> Lioness<H, S, B>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<H: KeySizeUser + OutputSizeUser, S: KeySizeUser + IvSizeUser, B> Drop for Lioness<H, S, 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>,

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<H: KeySizeUser + OutputSizeUser, S: KeySizeUser + IvSizeUser, B> IvSizeUser for Lioness<H, S, 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>, S::IvSize: Mul<U2>, <S::IvSize as Mul<U2>>::Output: ArrayLength<u8>,

Source§

type IvSize = <<S as IvSizeUser>::IvSize as Mul<UInt<UInt<UTerm, B1>, B0>>>::Output

Initialization vector size in bytes.
§

fn iv_size() -> usize

Return IV size in bytes.
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>,

Source§

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>

Create new value from variable length key and nonce.
§

fn generate_key( rng: impl CryptoRng + RngCore, ) -> GenericArray<u8, Self::KeySize>

Generate random key using the provided CryptoRng.
§

fn generate_iv(rng: impl CryptoRng + RngCore) -> GenericArray<u8, Self::IvSize>

Generate random IV using the provided CryptoRng.
§

fn generate_key_iv( rng: impl CryptoRng + RngCore, ) -> (GenericArray<u8, Self::KeySize>, GenericArray<u8, Self::IvSize>)

Generate random key and nonce using the provided CryptoRng.
Source§

impl<H: KeySizeUser + OutputSizeUser, S: KeySizeUser + IvSizeUser, B> KeySizeUser 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>, <H::OutputSize as Mul<U4>>::Output: ArrayLength<u8>,

Source§

type KeySize = <<H as OutputSizeUser>::OutputSize as Mul<UInt<UInt<UInt<UTerm, B1>, B0>, B0>>>::Output

Key size in bytes.
§

fn key_size() -> usize

Return key size in bytes.
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>,

Source§

fn forward(&self, data: &mut Block<Self>)

Forward permutation
Source§

fn inverse(&self, data: &mut Block<Self>)

Inverse permutation

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>
where H: Send, S: Send, B: Send,

§

impl<H, S, B> Sync for Lioness<H, S, B>
where H: Sync, S: Sync, B: Sync,

§

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> 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
§

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

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,