Module cryptoxide::hmac

source ·
Expand description

Implements the Hash Message Authentication Code (HMAC)

Examples

HMAC-SHA256 using a 16 bytes key of a simple input data

use cryptoxide::{hmac::Hmac, mac::Mac, sha2::Sha256};

let input = b"data";
let key = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15];
let mut h = Hmac::new(Sha256::new(), &key);
h.input(input);
let mac = h.result();

Structs

HMAC context parametrized by the hashing function