Skip to main content

HashDigest

Trait HashDigest 

Source
pub trait HashDigest<const BLOCK_SIZE: usize, const OUTPUT_SIZE: usize>: Default {
    // Required methods
    fn write(&mut self, bytes: &[u8]);
    fn hash(self, bytes: &[u8]) -> [u8; OUTPUT_SIZE];
    fn finish(self) -> [u8; OUTPUT_SIZE];
    fn algorithm() -> HashAlgorithm;
}
Expand description

Generic trait to describe a hash function

Required Methods§

Source

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

Source

fn hash(self, bytes: &[u8]) -> [u8; OUTPUT_SIZE]

Source

fn finish(self) -> [u8; OUTPUT_SIZE]

Source

fn algorithm() -> HashAlgorithm

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§

Source§

impl HashDigest<BLOCK_SIZE, OUTPUT_SIZE> for MD5

Source§

impl HashDigest<BLOCK_SIZE, OUTPUT_SIZE> for SHA1

Source§

impl HashDigest<{ $block_size }, { $output_size }> for SHA224

Source§

impl HashDigest<{ $block_size }, { $output_size }> for SHA256

Source§

impl HashDigest<{ $block_size }, { $output_size }> for SHA384

Source§

impl HashDigest<{ $block_size }, { $output_size }> for SHA512

Source§

impl<const NN: usize> HashDigest<64, NN> for BLAKE2s<NN>

Source§

impl<const NN: usize> HashDigest<128, NN> for BLAKE2b<NN>