Skip to main content

Digest

Trait Digest 

Source
pub trait Digest<const HASH_LEN: usize> {
    // Required methods
    fn hash(digest: &mut [u8], payload: &[u8]);
    fn update(&mut self, payload: &[u8]);
    fn finish(&self, digest: &mut [u8; HASH_LEN]);
    fn reset(&mut self);
}
Expand description

Re-export the Digest trait. A Hash algorithm returning hashes of length HASH_LEN.

Required Methods§

Source

fn hash(digest: &mut [u8], payload: &[u8])

Writes the digest for the given input byte slice, into digest in immediate mode.

Source

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

Add the payload to the digest.

Source

fn finish(&self, digest: &mut [u8; HASH_LEN])

Writes the digest into digest.

Note that the digest state can be continued to be used, to extend the digest.

Source

fn reset(&mut self)

Reset the digest state.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Source§

impl Digest<28> for Sha224

Source§

impl Digest<32> for Sha256

Source§

impl Digest<48> for Sha384

Source§

impl Digest<64> for Sha512