Trait nimue::hash::DuplexHash

source ·
pub trait DuplexHash<U = u8>: Default + Clone + Zeroize
where 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§

source

fn new(iv: [u8; 32]) -> Self

Initializes a new sponge, setting up the state.

source

fn absorb_unchecked(&mut self, input: &[U]) -> &mut Self

Absorbs new elements in the sponge.

source

fn squeeze_unchecked(&mut self, output: &mut [U]) -> &mut Self

Squeezes out new elements.

source

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.

Implementors§