Skip to main content

Digest

Trait Digest 

Source
pub trait Digest<const HASH_LEN: usize> {
    // Required methods
    fn update(&mut self, data: &[u8]) -> Result<(), Error>;
    fn finish_current(
        &mut self,
        hash: &mut CryptoSensitive<HASH_LEN>,
    ) -> Result<(), Error>;
    fn finish(self, hash: &mut CryptoSensitive<HASH_LEN>) -> Result<(), Error>;
}
Expand description

Trait representing a generic digest (hash) algorithm.

The digest algorithm should support incremental updates and finalization.

Used for both hashing and HMAC.

Required Methods§

Source

fn update(&mut self, data: &[u8]) -> Result<(), Error>

Update the digest with the given data.

Source

fn finish_current( &mut self, hash: &mut CryptoSensitive<HASH_LEN>, ) -> Result<(), Error>

Finish the digest and write the result into the given buffer, without consuming the hasher instance, allowing for further updates and finalizations.

Source

fn finish(self, hash: &mut CryptoSensitive<HASH_LEN>) -> Result<(), Error>

Finish the digest and write the result into the given buffer.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl<const HASH_LEN: usize> Digest<HASH_LEN> for DummyCrypto