Skip to main content

Algorithm

Trait Algorithm 

Source
pub trait Algorithm {
    const OUTPUT_LEN: usize;
    const BLOCK_LEN: usize;

    // Required methods
    fn hash_to_vec(input: &[u8]) -> Vec<u8>;
    fn new() -> Self;
    fn update(&mut self, input: &[u8]);
    fn digest_to_vec(self) -> Vec<u8>;
}
Expand description

Provides the ability to hash in an algorithm-agnostic manner.

Required Associated Constants§

Source

const OUTPUT_LEN: usize

The size of the resulting digest.

Source

const BLOCK_LEN: usize

The block length (in bytes).

Required Methods§

Source

fn hash_to_vec(input: &[u8]) -> Vec<u8>

Hashes a message.

Source

fn new() -> Self

Create a new context for incremental hashing.

Source

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

Hash the contents of input.

Source

fn digest_to_vec(self) -> Vec<u8>

Finish the hashing and return the digest.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§