pub trait Hmac: Send + Sync {
// Required methods
fn with_key(&self, key: &[u8]) -> Box<dyn Key>;
fn hash_output_len(&self) -> usize;
// Provided method
fn fips(&self) -> bool { ... }
}展开描述
A concrete HMAC implementation, 用于 一个 single cryptographic hash function.
You should have one object that implements this trait 用于 HMAC-SHA256, another 用于 HMAC-SHA384, etc.