Hashing

Message authentication codes

A message authentication code uses a secret key to produce a tag that lets the receiver verify a message has not been altered and came from someone holding the key. MACs provide integrity and authenticity, not confidentiality.

30 algorithms 15 families

MACs are built in three main ways: from hash functions (HMAC, KMAC, keyed BLAKE2 and BLAKE3), from block ciphers (CMAC, PMAC, CBC-MAC), or from universal hashing masked with a one-time value (Poly1305, GHASH and GMAC). Hash-based and cipher-based MACs can usually authenticate many messages under one key; universal-hash MACs require a fresh mask or nonce per message.

Short-input PRFs such as SipHash and Chaskey occupy a niche between MACs and hash-table hashing, trading output length for speed on small inputs. In all cases tags should be compared in constant time to avoid leaking information through timing.

Families

15
HMACsafe

The standard way to build a MAC from a cryptographic hash (RFC 2104, FIPS 198-1)

8 variants · hmac hmac-md5 hmac-sha1 hmac-sha256 hmac-sha3-256 hmac-sha3-384 hmac-sha3-512 hmac-sha512
AES-GMACstandard

The authentication-only mode of AES-GCM: a nonce-based MAC from GHASH and AES

1 variant · aes-gmac
Asconstandard

NIST's lightweight standard: one 320-bit permutation for hashing, XOFs, MACs and AEAD

2 variants · ascon-mac ascon-prf
BLAKE2standard

A fast, secure successor to BLAKE with built-in keying, salting and tree hashing

2 variants · blake2b-mac blake2s-mac
BLAKE3standard

A Merkle-tree hash over BLAKE2s rounds, designed for parallel speed and unlimited output

1 variant · blake3-mac
CMACstandard

The block-cipher MAC standardised by NIST in SP 800-38B, usually instantiated with AES

2 variants · aes-cmac aes-cmac-prf-128
Chaskeystandard

A lightweight ARX permutation-based MAC for 32-bit microcontrollers (ISO/IEC 29192-6)

1 variant · chaskey
KMACstandard

NIST's Keccak-based MAC from SP 800-185, with optional arbitrary-length output

4 variants · kmac128 kmac256 kmacxof128 kmacxof256
Poly1305standard

Bernstein's fast one-time authenticator, paired with ChaCha20 in RFC 8439

1 variant · poly1305
SipHashstandard

A short-input keyed PRF designed to protect hash tables from flooding attacks

2 variants · siphash-2-4 siphash-4-8
CBC-MAC and DES-MAClegacy

The original block-cipher MAC: secure only for fixed-length messages

2 variants · cbc-mac des-mac
GHASHresearch

The GF(2^128) polynomial hash at the core of AES-GCM and GMAC

1 variant · ghash
PMACresearch

Rogaway's fully parallelisable block-cipher MAC

1 variant · aes-pmac
Pelican MACunverified

Pelican MAC: an AES-based message authentication code with a 16-byte tag, unverified in NextSSL

1 variant · pelican
Two-Track-MAC (TTMAC)unverified

Two-Track-MAC: a NESSIE-era MAC with 20-byte keys and tags, archived as unverified

1 variant · ttmac