Function orion::default::hmac_verify [] [src]

pub fn hmac_verify(
    expected_hmac: &[u8],
    secret_key: &[u8],
    message: &[u8]
) -> Result<bool, UnknownCryptoError>

Verify an HMAC against a key and message in constant time and with Double-HMAC Verification.

Usage example:

use orion::default;
use orion::util;

let key = util::gen_rand_key(64).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);