Function orion::default::hmac_verify [−][src]
pub fn hmac_verify(
expected_hmac: &[u8],
secret_key: &[u8],
data: &[u8]
) -> Result<bool, ValidationCryptoError>
Verify a HMAC-SHA512 MAC in constant time, with Double-HMAC Verification.
About:
This uses default::hmac()
to generate the MAC.
Example:
use orion::default; use orion::utilities::util; let mut key = [0u8; 64]; util::gen_rand_key(&mut key).unwrap(); let msg = "Some message.".as_bytes(); let expected_hmac = default::hmac(&key, msg).unwrap(); assert_eq!(default::hmac_verify(&expected_hmac, &key, &msg).unwrap(), true);