Skip to main content

Hasher

Trait Hasher 

Source
pub trait Hasher: Clone + Zeroize {
    const BLOCK_SIZE: usize;
    const OUTPUT_SIZE: usize;

    // Required methods
    fn new() -> Self;
    fn update(&mut self, data: &[u8]);
    fn sum(self) -> Hash;

    // Provided method
    fn hash(data: &[u8]) -> Hash { ... }
}
Expand description

Zeroize is a no-op when the zeroize feature is not enabled.

Required Associated Constants§

Source

const BLOCK_SIZE: usize

The internal block size of the hash function

Source

const OUTPUT_SIZE: usize

The output size of the hash function.

Must not exceed MAX_HASH_OUTPUT_SIZE (64), the fixed capacity of [Hash]; implementors with a larger OUTPUT_SIZE will not compile when used with functions that bound-check against this limit.

Required Methods§

Source

fn new() -> Self

Source

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

Source

fn sum(self) -> Hash

Provided Methods§

Source

fn hash(data: &[u8]) -> Hash

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§