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 { ... }
}展开描述
Describes 一个 single cryptographic hash function.
This interface can do both one-shot 并 incremental hashing, using
Hash::hash() 并 Hash::start() respectively.