pub struct Keccak<E, const TYPE: u8, const VARIANT: usize>where
E: Environment,{ /* private fields */ }
Expand description
The sponge construction Sponge[f, pad, r]
is a function that takes a variable-length input
and produces a fixed-length output (the hash value).
The permutation f
is a function that takes a fixed-length input and produces a fixed-length output,
defined as f = Keccak-f[b]
, where b := 25 * 2^l
is the width of the permutation,
and l
is the log width of the permutation.
For our case, l = 6
, thus b = 1600
.
The padding rule pad
is a function that takes a variable-length input and produces a fixed-length output.
In Keccak, pad
is a multi-rate padding, defined as pad(M) = M || 0x01 || 0x00…0x00 || 0x80
,
where M
is the input data, and 0x01 || 0x00…0x00 || 0x80
is the padding.
In SHA-3, pad
is a SHAKE, defined as pad(M) = M || 0x06 || 0x00…0x00 || 0x80
,
where M
is the input data, and 0x06 || 0x00…0x00 || 0x80
is the padding.
The bitrate r
is the number of bits that are absorbed into the sponge state in each iteration
of the absorbing phase.
In addition, the capacity is defined as c := b - r
.
Implementations§
Trait Implementations§
Source§impl<E, const TYPE: u8, const VARIANT: usize> Clone for Keccak<E, TYPE, VARIANT>where
E: Clone + Environment,
impl<E, const TYPE: u8, const VARIANT: usize> Clone for Keccak<E, TYPE, VARIANT>where
E: Clone + Environment,
Source§impl<E, const TYPE: u8, const VARIANT: usize> Debug for Keccak<E, TYPE, VARIANT>where
E: Debug + Environment,
impl<E, const TYPE: u8, const VARIANT: usize> Debug for Keccak<E, TYPE, VARIANT>where
E: Debug + Environment,
Source§impl<E, const TYPE: u8, const VARIANT: usize> Default for Keccak<E, TYPE, VARIANT>where
E: Default + Environment,
impl<E, const TYPE: u8, const VARIANT: usize> Default for Keccak<E, TYPE, VARIANT>where
E: Default + Environment,
Source§impl<E, const TYPE: u8, const VARIANT: usize> Hash for Keccak<E, TYPE, VARIANT>where
E: Environment,
impl<E, const TYPE: u8, const VARIANT: usize> Hash for Keccak<E, TYPE, VARIANT>where
E: Environment,
Source§impl<E, const TYPE: u8, const VARIANT: usize> LeafHash for Keccak<E, TYPE, VARIANT>where
E: Environment,
impl<E, const TYPE: u8, const VARIANT: usize> LeafHash for Keccak<E, TYPE, VARIANT>where
E: Environment,
Source§impl<E, const TYPE: u8, const VARIANT: usize> PathHash<E> for Keccak<E, TYPE, VARIANT>where
E: Environment,
impl<E, const TYPE: u8, const VARIANT: usize> PathHash<E> for Keccak<E, TYPE, VARIANT>where
E: Environment,
Source§fn hash_children(
&self,
children: &[<Keccak<E, TYPE, VARIANT> as PathHash<E>>::Hash],
) -> <Keccak<E, TYPE, VARIANT> as PathHash<E>>::Hash
fn hash_children( &self, children: &[<Keccak<E, TYPE, VARIANT> as PathHash<E>>::Hash], ) -> <Keccak<E, TYPE, VARIANT> as PathHash<E>>::Hash
Returns the hash of the given child nodes.
type Hash = BooleanHash<E, VARIANT>
type Primitive = Keccak<TYPE, VARIANT>
Source§fn hash_empty<const ARITY: u8>(&self) -> Self::Hash
fn hash_empty<const ARITY: u8>(&self) -> Self::Hash
Auto Trait Implementations§
impl<E, const TYPE: u8, const VARIANT: usize> Freeze for Keccak<E, TYPE, VARIANT>
impl<E, const TYPE: u8, const VARIANT: usize> RefUnwindSafe for Keccak<E, TYPE, VARIANT>
impl<E, const TYPE: u8, const VARIANT: usize> Send for Keccak<E, TYPE, VARIANT>
impl<E, const TYPE: u8, const VARIANT: usize> Sync for Keccak<E, TYPE, VARIANT>
impl<E, const TYPE: u8, const VARIANT: usize> Unpin for Keccak<E, TYPE, VARIANT>
impl<E, const TYPE: u8, const VARIANT: usize> UnwindSafe for Keccak<E, TYPE, VARIANT>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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>
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