Hasher

Trait Hasher 

Source
pub trait Hasher {
    type Output;

    // Required methods
    fn clean(&mut self) -> &mut Self;
    fn finish(&self) -> Result<Self::Output>;
    fn include(&mut self, data: impl AsRef<[u8]>) -> &mut Self;
}
Expand description

A Hasher defines a common interface for defining specific hashing algorithm.

Required Associated Types§

Source

type Output

the output type of the hasher

Required Methods§

Source

fn clean(&mut self) -> &mut Self

reset the hasher to its initial state

Source

fn finish(&self) -> Result<Self::Output>

finalize the hash and return the result

Source

fn include(&mut self, data: impl AsRef<[u8]>) -> &mut Self

update the hasher with new data

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.

Implementations on Foreign Types§

Source§

impl Hasher for Hasher

Source§

type Output = H256

Source§

fn clean(&mut self) -> &mut Self

Source§

fn finish(&self) -> Result<Self::Output>

Source§

fn include(&mut self, data: impl AsRef<[u8]>) -> &mut Self

Implementors§