Computational cryptography › Hashes and symmetric ciphers
MAC / KEY DERIVATIONPrimitive

HMAC, HKDF

In plain words

HMAC checks a message wasn't altered, using a shared key. HKDF turns one secret into several independent keys.

The idea: HMAC hashes the message together with the secret key, in two nested passes. Without the key, the result looks like random noise, so nobody can produce a valid tag for a changed message. HKDF uses the same construction as a key mixer: feed it one shared secret and different labels ("client key", "server key") and get independent keys for each job.

Why it matters: Inside TLS, Signal and many other protocols.

The details

HMAC authenticates messages using a hash and a secret key[1, 2]. HKDF derives several independent keys from one shared secret[3, 4]. Both are used in TLS 1.3, Signal and HPKE.

Security relies on the hash's internal compression function behaving like a pseudorandom function, not on collision resistance[5], which is why HMAC-MD5 and HMAC-SHA1 were never practically broken.

Rests on

If any of these breaks, this breaks too.

If it falls

If this breaks, these break with it.

Nothing on the map depends on it: it is an end point, something people use directly.

References

  1. Mihir Bellare, Ran Canetti and Hugo Krawczyk. Keying Hash Functions for Message Authentication. Advances in Cryptology — CRYPTO ’96, 1996. doi:10.1007/3-540-68697-5_1
  2. H. Krawczyk, M. Bellare and R. Canetti. HMAC: Keyed-Hashing for Message Authentication. RFC 2104, 1997. rfc-editor.org/rfc/rfc2104
  3. Hugo Krawczyk. Cryptographic Extraction and Key Derivation: The HKDF Scheme. Advances in Cryptology – CRYPTO 2010. doi:10.1007/978-3-642-14623-7_34
  4. H. Krawczyk and P. Eronen. HMAC-based Extract-and-Expand Key Derivation Function (HKDF). RFC 5869, 2010. rfc-editor.org/rfc/rfc5869
  5. Mihir Bellare. New Proofs for NMAC and HMAC: Security without Collision Resistance. Journal of Cryptology, 2015. doi:10.1007/s00145-014-9185-x