Skip to main content

Crate ic_mac

Crate ic_mac 

Source
Expand description

§ic-mac — message authentication codes

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§

CmacAes128
CMAC-AES-128 (SP 800-38B).
CmacAes192
CMAC-AES-192 (SP 800-38B).
CmacAes256
CMAC-AES-256 (SP 800-38B).
HmacSha3_256
HMAC-SHA3-256.
HmacSha3_512
HMAC-SHA3-512.
HmacSha256
HMAC-SHA-256.
HmacSha384
HMAC-SHA-384.
HmacSha512
HMAC-SHA-512.
HmacSha512_256
HMAC-SHA-512/256.