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§
- Cmac
Aes128 - CMAC-AES-128 message authentication code (16-byte tag).
- Cmac
Aes256 - CMAC-AES-256 message authentication code (16-byte tag).
- Hmac
Sha3_ 256 - HMAC-SHA3-256 message authentication code (32-byte tag).
- Hmac
Sha3_ 512 - HMAC-SHA3-512 message authentication code (64-byte tag).
- Hmac
Sha256 - HMAC-SHA-256 message authentication code (32-byte tag).
- Hmac
Sha384 - HMAC-SHA-384 message authentication code (48-byte tag).
- Hmac
Sha512 - HMAC-SHA-512 message authentication code (64-byte tag).
- Hmac
Streaming Adapter - Generic streaming MAC adapter wrapping
hmac::Hmac<D>. - Kmac128
- KMAC128 message authentication code (SP 800-185).
- Kmac256
- KMAC256 message authentication code (SP 800-185).
- Poly1305
Mac - 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§
- Hmac
Sha256 Streaming - Streaming HMAC-SHA-256 adapter.
- Hmac
Sha384 Streaming - Streaming HMAC-SHA-384 adapter.
- Hmac
Sha512 Streaming - Streaming HMAC-SHA-512 adapter.