ic-mac 0.1.1

HMAC, CMAC, KMAC, and Poly1305 message authentication for IronCrypto
Documentation
ic-mac-0.1.1 has been yanked.

ic-mac — message authentication codes

  • [Hmac] — FIPS 198-1, generic over any Digest in ic-hash.
  • [CmacAes128] / [CmacAes256] — SP 800-38B CMAC over AES.
  • [Poly1305] — re-exported from ic-cipher for one-time authentication.

All verification goes through [ic_core::ct::verify], so tag comparison cannot become a timing oracle.

use ic_mac::HmacSha256;
use ic_core::traits::Mac;

let tag = HmacSha256::mac(b"key", b"message")?;
HmacSha256::verify(b"key", b"message", tag.as_ref())?;
assert!(HmacSha256::verify(b"key", b"tampered", tag.as_ref()).is_err());
# Ok::<(), ic_core::Error>(())