pub trait Digest:
Algorithm
+ Clone
+ Default {
type Output: AsRef<[u8]> + AsMut<[u8]> + Copy;
const OUTPUT_LEN: usize;
const BLOCK_LEN: usize;
// Required methods
fn new() -> Self;
fn update(&mut self, data: &[u8]);
fn finalize(self) -> Result<Self::Output>;
// Provided method
fn digest(data: &[u8]) -> Result<Self::Output> { ... }
}Expand description
A cryptographic hash function with a fixed-length output.
Producing output can fail: Digest::finalize and Digest::digest
refuse with ErrorKind::ModuleErrorState once the
module is in its error state, and, in a build with
--cfg ic_approved_only, before ic_fips::initialize has passed the
self-tests. Making a hasher and absorbing input produce nothing, and do not
refuse.
Implemented for every type that implements [internal::Digest], which is
how the hash functions are written.
Required Associated Constants§
Sourceconst OUTPUT_LEN: usize
const OUTPUT_LEN: usize
Output length in bytes.
Required Associated Types§
Required Methods§
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".