Hasher

Trait Hasher 

Source
pub trait Hasher {
    type Output;

    // Required method
    fn hash(input: &[u8]) -> Self::Output;
}
Expand description

Trait you need to implement for the various hash functions you need to provide. Currently only a single function, that computes the hash of a string slice, is needed. This may change in a later version.

Beware: There is currently no way to put constraints on associated constants in Rust, so Block Size is not exposed. It’s anyhow the same (currently hardcoded) value for all supported algorithms.

Required Associated Types§

Source

type Output

The output type of the respective hash function. Typically some form of byte array.

Required Methods§

Source

fn hash(input: &[u8]) -> Self::Output

Function that takes a byte array as input, and generates the cryptographic hash of it as output.

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.

Implementors§