liveBook · Manning

HKDF-Expand

As explained in Real-World Cryptography

HKDF-Expand is the HKDF function that deterministically expands a pseudorandom key and context information into output of a requested length.

HKDF-Expand deterministically turns an already uniform secret into output of a requested length. An optional info value separates uses of the same secret across protocols or purposes. section 8.6

Use HKDF-Expand in this sequence:

  • Start with a uniformly random secret, usually produced by HKDF-Extract; skip extraction only when the input is already uniform. section 8.6
  • Supply optional info to distinguish the derivation from other protocol uses. section 8.6
  • Request the required output length; different lengths produce related outputs, with shorter results truncating the same expansion. section 8.6

Separate two derived keys

Given the same uniformly random secret, use different info values for separate purposes. The resulting outputs differ, while the requested length controls how much key material each purpose receives. section 8.6

Figure 8.7 HKDF-Expand is the second function specified by HKDF. It takes an optional info byte string and an input secret that needs to be uniformly random. Using different info byte strings with the same input secret produces different outputs. The length of the output is controlled by a length argument.

Visualizes the uniform secret, optional info value, and requested output length. section 8.6

How Real-World Cryptography covers it

How deep it goes
Explains inputs, extraction prerequisites, context separation, and length behavior without descending into implementation details.
Examples
Illustrates different info values with one secret and different requested lengths producing related outputs.
What it assumes
Assumes a uniformly random secret and distinguishes that requirement from HKDF-Extract’s handling of nonuniform input.
What you can do after
Apply HKDF-Expand by supplying a uniform secret, optional info value, and requested output length.
How it connects
Connects HKDF-Expand to HKDF-Extract, HMAC, KDFs, PRNGs, and domain separation.

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.