Trait DuplexSpongeInterface

Source
pub trait DuplexSpongeInterface {
    // Required methods
    fn new(iv: [u8; 32]) -> Self;
    fn absorb(&mut self, input: &[u8]);
    fn squeeze(&mut self, length: usize) -> Vec<u8> ;
    fn ratchet(&mut self);
}
Expand description

A trait defining the behavior of a duplex sponge construction.

A duplex sponge allows for:

  • Absorbing input data into the sponge state
  • Squeezing output data from the sponge state

This is the core primitive used for building cryptographic codecs.

Required Methods§

Source

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

Creates a new sponge instance with a given initialization vector (IV).

The IV enables domain separation and reproducibility between parties.

Source

fn absorb(&mut self, input: &[u8])

Absorbs input data into the sponge state.

Source

fn squeeze(&mut self, length: usize) -> Vec<u8>

Squeezes output data from the sponge state.

Source

fn ratchet(&mut self)

Applies a state ratcheting mechanism to prevent backtracking attacks.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§