Trait mundane::hash::Hasher

source ·
pub trait Hasher: Default + Clone + Hasher + Hasher {
    type Digest: Digest;

    // Required methods
    fn update(&mut self, bytes: &[u8]);
    fn finish(self) -> Self::Digest;

    // Provided method
    fn hash(bytes: &[u8]) -> Self::Digest { ... }
Expand description

A cryptographic hash function.

Required Associated Types§


type Digest: Digest

The output digest.

Required Methods§


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

Adds bytes to the hash.


fn finish(self) -> Self::Digest

Returns the digest of the bytes added so far.

Provided Methods§


fn hash(bytes: &[u8]) -> Self::Digest

Computes the hash of a sequence of bytes.

hash creates a new instance of this hash function, adds bytes to it, and then computes the digest.

Object Safety§

This trait is not object safe.