liveBook · Manning

HKDF

As explained in Real-World Cryptography

HKDF is a key derivation function that derives cryptographic keying material from input keying material using HMAC.

HKDF turns a high-entropy secret that may be biased—such as key-exchange output—into uniformly random keying material. Built on HMAC and defined in RFC 5869, it is deterministic and normally derives a limited number of keys rather than generating endless random numbers. section 8.6 section 8.9

Use HKDF in two named stages:

  • HKDF-Extract accepts the input secret and an optional public salt, using HMAC to produce a uniformly random secret. Reusing different salts separates usages within the same protocol. section 8.6
  • HKDF-Expand accepts the extracted secret, optional info, and a requested length, producing uniformly random output; different info values separate derived outputs. section 8.6

Key-exchange output

When a key exchange produces a high-entropy but biased result, run HKDF-Extract to remove bias, then HKDF-Expand to derive the uniformly random keys required by the protocol. section 8.6

Figure 8.10 HKDF is usually found implemented as a single function call that combines both HKDF-Extract (to extract uniform randomness from an input key) and HKDF-Expand (to generate an arbitrary length output).

Use the combined-flow diagram to see how a typical HKDF call joins Extract and Expand. section 8.6

How Real-World Cryptography covers it

How deep it goes
Explains Extract and Expand, salt, info, output length, and implementation composition without descending into formal internals.
Examples
Uses biased key-exchange output, public salts, info values, and combined Extract-and-Expand calls as concrete examples.
What it assumes
Assumes familiarity with HMAC and MACs while introducing KDFs, Extract, Expand, salts, and protocol key derivation.
What you can do after
Apply it to derive uniformly random cryptographic keys from high-entropy input secrets.
How it connects
Connects HKDF to HMAC, MACs, PRNGs, key exchange, uniformly random keys, and key management.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Real-World Cryptography. The section links point to the parts of the book it draws on.