Skip to main content

Xof

Trait Xof 

Source
pub trait Xof {
    const BLOCK_LEN: usize;

    // Required methods
    fn new() -> Self;
    fn update(&mut self, data: &[u8]);
    fn squeeze(&mut self, out: &mut [u8]);
}
Expand description

Trait for extendable-output functions (XOF) such as SHAKE128 / SHAKE256.

Unlike a fixed-output Hasher, an XOF can be squeeze-d for any number of bytes after absorption is complete. The internal sponge state is mutated by every squeeze call, so successive squeezes extend the output stream rather than restart it.

Required Associated Constants§

Source

const BLOCK_LEN: usize

Sponge rate (number of bytes absorbed per Keccak-f permutation).

Required Methods§

Source

fn new() -> Self

Create a fresh XOF instance with empty absorbed state.

Source

fn update(&mut self, data: &[u8])

Absorb additional input. May be called any number of times before the first squeeze.

Source

fn squeeze(&mut self, out: &mut [u8])

Squeeze out.len() bytes of output. Can be called multiple times; successive calls extend the same output stream (they do not reset).

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§