pub struct Keccak<const TYPE: u8, const VARIANT: usize>;
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
.
Trait Implementations§
impl<const TYPE: u8, const VARIANT: usize> Copy for Keccak<TYPE, VARIANT>
impl<const TYPE: u8, const VARIANT: usize> StructuralPartialEq for Keccak<TYPE, VARIANT>
Auto Trait Implementations§
impl<const TYPE: u8, const VARIANT: usize> Freeze for Keccak<TYPE, VARIANT>
impl<const TYPE: u8, const VARIANT: usize> RefUnwindSafe for Keccak<TYPE, VARIANT>
impl<const TYPE: u8, const VARIANT: usize> Send for Keccak<TYPE, VARIANT>
impl<const TYPE: u8, const VARIANT: usize> Sync for Keccak<TYPE, VARIANT>
impl<const TYPE: u8, const VARIANT: usize> Unpin for Keccak<TYPE, VARIANT>
impl<const TYPE: u8, const VARIANT: usize> UnwindSafe for Keccak<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