Trait StatefulHasher

Source
pub trait StatefulHasher:
    Default
    + Send
    + Sync {
    type Size: Size;
    type Digest: Digest<Self::Size>;

    // Required methods
    fn update(&mut self, input: &[u8]);
    fn finalize(&self) -> Self::Digest;
    fn reset(&mut self);
}
Expand description

Trait implemented by a hash function implementation.

Required Associated Types§

Source

type Size: Size

The maximum Digest size for that hasher (it is stack allocated).

Source

type Digest: Digest<Self::Size>

The Digest type to distinguish the output of different Hasher implementations.

Required Methods§

Source

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

Consume input and update internal state.

Source

fn finalize(&self) -> Self::Digest

Returns the final digest.

Source

fn reset(&mut self)

Reset the internal hasher state.

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§

Source§

impl StatefulHasher for Keccak224

Source§

impl StatefulHasher for Keccak256

Source§

impl StatefulHasher for Keccak384

Source§

impl StatefulHasher for Keccak512

Source§

impl StatefulHasher for Sha1

Source§

impl StatefulHasher for Sha2_256

Source§

impl StatefulHasher for Sha2_512

Source§

impl StatefulHasher for Sha3_224

Source§

impl StatefulHasher for Sha3_256

Source§

impl StatefulHasher for Sha3_384

Source§

impl StatefulHasher for Sha3_512

Source§

impl<S: Size> StatefulHasher for Blake2bHasher<S>

Source§

impl<S: Size> StatefulHasher for Blake2sHasher<S>

Source§

impl<S: Size> StatefulHasher for Blake3Hasher<S>

Source§

impl<S: Size> StatefulHasher for IdentityHasher<S>

Source§

impl<S: Size> StatefulHasher for StrobeHasher<S>