Trait sc_network::multiaddr::multihash::MultihashDigest[][src]

pub trait MultihashDigest<T> where
    T: TryFrom<u64>, 
{ pub fn code(&self) -> T;
pub fn digest(&self, data: &[u8]) -> MultihashGeneric<T>;
pub fn input(&mut self, data: &[u8]);
pub fn result(self) -> MultihashGeneric<T>;
pub fn result_reset(&mut self) -> MultihashGeneric<T>;
pub fn reset(&mut self); }

The MultihashDigest trait specifies an interface common for all multihash functions.

Required methods

pub fn code(&self) -> T[src]

The Mutlihash byte value.

pub fn digest(&self, data: &[u8]) -> MultihashGeneric<T>[src]

Hash some input and return the digest.

Panics

Panics if the digest length is bigger than 2^32. This only happens for identity hasing.

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

Digest data, updating the internal state.

This method can be called repeatedly for use with streaming messages.

Panics

Panics if the digest length is bigger than 2^32. This only happens for identity hashing.

pub fn result(self) -> MultihashGeneric<T>[src]

Retrieve the computed MultihashGeneric, consuming the hasher.

pub fn result_reset(&mut self) -> MultihashGeneric<T>[src]

Retrieve result and reset hasher instance.

This method sometimes can be more efficient compared to hasher re-creation.

pub fn reset(&mut self)[src]

Reset hasher instance to its initial state.

Loading content...

Implementors

impl MultihashDigest<Code> for Blake2b256[src]

impl MultihashDigest<Code> for Blake2b512[src]

impl MultihashDigest<Code> for Blake2s128[src]

impl MultihashDigest<Code> for Blake2s256[src]

impl MultihashDigest<Code> for Identity[src]

impl MultihashDigest<Code> for Keccak224[src]

impl MultihashDigest<Code> for Keccak256[src]

impl MultihashDigest<Code> for Keccak384[src]

impl MultihashDigest<Code> for Keccak512[src]

impl MultihashDigest<Code> for Sha1[src]

impl MultihashDigest<Code> for Sha2_256[src]

impl MultihashDigest<Code> for Sha2_512[src]

impl MultihashDigest<Code> for Sha3_224[src]

impl MultihashDigest<Code> for Sha3_256[src]

impl MultihashDigest<Code> for Sha3_384[src]

impl MultihashDigest<Code> for Sha3_512[src]

Loading content...