universal_hashes
universal_hashes
Universal Hashes
Mojo implementations of universal hash functions — keyed hashes used as the core of message authentication codes (MACs), typically inside AEAD constructions such as AES-GCM and AES-GCM-SIV.
All algorithms share the UniversalHashable trait (traits.mojo): construct
from a KEY_SIZE-byte key, absorb BLOCK_SIZE blocks via update /
update_padded, then finalize into a TAG_SIZE-byte tag.
Implemented algorithms
| Algorithm | Directory | Description |
|---|---|---|
| GHASH | ghash/ |
GF(2¹²⁸) hash used by AES-GCM |
| POLYVAL | polyval/ |
GF(2¹²⁸) hash used by AES-GCM-SIV (byte-reversed GHASH) |
References
- Wikipedia — Universal hashing
- RFC 8452 — AES-GCM-SIV (Appendix A relates GHASH and POLYVAL)
Mojo package 🡭