pub trait Hash: Send + Sync {
// Required methods
fn start(&self) -> Box<dyn Context>;
fn hash(&self, data: &[u8]) -> Output;
fn output_len(&self) -> usize;
fn algorithm(&self) -> HashAlgorithm;
// Provided method
fn fips(&self) -> bool { ... }
}
Expand description
Describes a single cryptographic hash function.
This interface can do both one-shot and incremental hashing, using
Hash::hash()
and Hash::start()
respectively.
Required Methods§
sourcefn output_len(&self) -> usize
fn output_len(&self) -> usize
The length in bytes of this hash function’s output.
sourcefn algorithm(&self) -> HashAlgorithm
fn algorithm(&self) -> HashAlgorithm
Which hash function this is, eg, HashAlgorithm::SHA256
.