Skip to main content

Crate oxicrypto_mac

Crate oxicrypto_mac 

Source
Expand description

Pure Rust MAC implementations for the OxiCrypto stack.

Provides Mac and StreamingMac trait wrappers for:

  • HMAC-SHA-256 / SHA-384 / SHA-512 (one-shot + streaming + truncated)
  • HMAC-SHA3-256 / SHA3-512
  • Poly1305 (one-time MAC)
  • CMAC-AES-128 / CMAC-AES-256
  • KMAC128 / KMAC256 (SP 800-185, via tiny-keccak)

All MAC verifications use constant-time comparison via the subtle crate.

Structs§

CmacAes128
CMAC-AES-128 message authentication code (16-byte tag).
CmacAes256
CMAC-AES-256 message authentication code (16-byte tag).
HmacSha3_256
HMAC-SHA3-256 message authentication code (32-byte tag).
HmacSha3_512
HMAC-SHA3-512 message authentication code (64-byte tag).
HmacSha256
HMAC-SHA-256 message authentication code (32-byte tag).
HmacSha384
HMAC-SHA-384 message authentication code (48-byte tag).
HmacSha512
HMAC-SHA-512 message authentication code (64-byte tag).
HmacStreamingAdapter
Generic streaming MAC adapter wrapping hmac::Hmac<D>.
Kmac128
KMAC128 message authentication code (SP 800-185).
Kmac256
KMAC256 message authentication code (SP 800-185).
Poly1305Mac
Poly1305 one-time message authentication code (16-byte tag).

Functions§

blake3_keyed_mac
BLAKE3 keyed-hash MAC (BLAKE3 spec §2.7).
blake3_keyed_mac_verify
Verify a BLAKE3 keyed-hash MAC in constant time.
hmac_sha256_to_vec
Compute an HMAC-SHA-256 tag and return it as a 32-byte Vec<u8>.
hmac_sha256_verify_truncated
Verify the first truncated_tag.len() bytes of an HMAC-SHA-256 MAC.
hmac_sha384_to_vec
Compute an HMAC-SHA-384 tag and return it as a 48-byte Vec<u8>.
hmac_sha512_to_vec
Compute an HMAC-SHA-512 tag and return it as a 64-byte Vec<u8>.
kmac128_xof
KMAC128 with variable-length output (XOF mode, SP 800-185 §4.3.1).
kmac256_xof
KMAC256 with variable-length output (XOF mode, SP 800-185 §4.3.1).

Type Aliases§

HmacSha256Streaming
Streaming HMAC-SHA-256 adapter.
HmacSha384Streaming
Streaming HMAC-SHA-384 adapter.
HmacSha512Streaming
Streaming HMAC-SHA-512 adapter.