Trait tetsy_libp2p::multiaddr::multihash::StatefulHasher[]

pub trait StatefulHasher: Default + Send + Sync {
    type Size: Size;
    type Digest: Digest<Self::Size>;
    pub fn update(&mut self, input: &[u8]);
pub fn finalize(&self) -> Self::Digest;
pub fn reset(&mut self); }

Trait implemented by a hash function implementation.

Associated Types

type Size: Size

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

type Digest: Digest<Self::Size>

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

Loading content...

Required methods

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

Consume input and update internal state.

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

Returns the final digest.

pub fn reset(&mut self)

Reset the internal hasher state.

Loading content...

Implementors

impl StatefulHasher for Sha2_256

type Size = UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>

type Digest = Sha2Digest<<Sha2_256 as StatefulHasher>::Size>

impl StatefulHasher for Sha2_512

type Size = UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>

type Digest = Sha2Digest<<Sha2_512 as StatefulHasher>::Size>

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

type Size = S

type Digest = IdentityDigest<<IdentityHasher<S> as StatefulHasher>::Size>

Loading content...