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§
Sourceconst OUTPUT_LEN: usize
const OUTPUT_LEN: usize
The size of the resulting digest.
Required Methods§
Sourcefn hash_to_vec(input: &[u8]) -> Vec<u8>
fn hash_to_vec(input: &[u8]) -> Vec<u8>
Hashes a message.
Sourcefn digest_to_vec(self) -> Vec<u8>
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".