Trait nimue::hash::DuplexHash
source · pub trait DuplexHash<U = u8>: Default + Clone + Zeroizewhere
U: Unit,{
// Required methods
fn new(iv: [u8; 32]) -> Self;
fn absorb_unchecked(&mut self, input: &[U]) -> &mut Self;
fn squeeze_unchecked(&mut self, output: &mut [U]) -> &mut Self;
fn ratchet_unchecked(&mut self) -> &mut Self;
}
Expand description
A DuplexHash
is an abstract interface for absorbing and squeezing data.
The type parameter U
represents basic unit that the sponge works with.
We require DuplexHash
implementations to have a std::default::Default
implementation, that initializes
to zero the hash function state, and a zeroize::Zeroize
implementation for secure deletion.
HAZARD: Don’t implement this trait unless you know what you are doing. Consider using the sponges already provided by this library.
Required Methods§
sourcefn absorb_unchecked(&mut self, input: &[U]) -> &mut Self
fn absorb_unchecked(&mut self, input: &[U]) -> &mut Self
Absorbs new elements in the sponge.
sourcefn squeeze_unchecked(&mut self, output: &mut [U]) -> &mut Self
fn squeeze_unchecked(&mut self, output: &mut [U]) -> &mut Self
Squeezes out new elements.
sourcefn ratchet_unchecked(&mut self) -> &mut Self
fn ratchet_unchecked(&mut self) -> &mut Self
Ratcheting.
This operations makes sure that different elements are processed in different blocks. Right now, this is done by:
- permuting the state.
- zero rate elements. This has the effect that state holds no information about the elements absorbed so far. The resulting state is compressed.
Object Safety§
This trait is not object safe.