Expand description
§ic-mac — message authentication codes
Hmac— FIPS 198-1, generic over anyDigestinic-hash.CmacAes128/CmacAes256— SP 800-38B CMAC over AES.Poly1305— re-exported fromic-cipherfor 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());Structs§
- Hmac
- HMAC over the digest
D. - Kmac128
- SP 800-185 KMAC128, offering 128-bit security.
- Kmac256
- SP 800-185 KMAC256, offering 256-bit security.
- Poly1305
- RFC 8439 Poly1305 one-time authenticator.
Constants§
- MAC_IDS
- Ontology identifiers for the MACs this crate provides.
Type Aliases§
- Cmac
Aes128 - CMAC-AES-128 (SP 800-38B).
- Cmac
Aes192 - CMAC-AES-192 (SP 800-38B).
- Cmac
Aes256 - CMAC-AES-256 (SP 800-38B).
- Hmac
Sha3_ 256 - HMAC-SHA3-256.
- Hmac
Sha3_ 512 - HMAC-SHA3-512.
- Hmac
Sha256 - HMAC-SHA-256.
- Hmac
Sha384 - HMAC-SHA-384.
- Hmac
Sha512 - HMAC-SHA-512.
- Hmac
Sha512_ 256 - HMAC-SHA-512/256.