Trait chksum_core::Hash

source ·
pub trait Hash: Default {
    type Digest: Digest;

    // Required methods
    fn update<T>(&mut self, data: T)
       where T: AsRef<[u8]>;
    fn reset(&mut self);
    fn digest(&self) -> Self::Digest;

    // Provided method
    fn hash<T>(data: T) -> Self::Digest
       where T: AsRef<[u8]> { ... }
}
Expand description

A trait for hash objects.

Required Associated Types§

source

type Digest: Digest

The type representing the digest produced by finalizing the hash.

Required Methods§

source

fn update<T>(&mut self, data: T)
where T: AsRef<[u8]>,

Updates the hash state with an input data.

source

fn reset(&mut self)

Resets the hash state to its initial state.

source

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

Produces the hash digest.

Provided Methods§

source

fn hash<T>(data: T) -> Self::Digest
where T: AsRef<[u8]>,

Calculates the hash digest of an input data.

Object Safety§

This trait is not object safe.

Implementors§