Visual RFC.
ALL RFCs / RFC 5869
Read the RFC ↗
RFC 5869 / HKDF KEY DERIVATION

Chain expansion blocks with a byte counter

03

Expand repeatedly applies HMAC with the same PRK key, the previous block, the context info and a one-octet counter.

RFC 5869 · § 2.3EXAMPLE
3 / 3
Chain expansion blocks with a byte counterFor an illustrative SHA-256 expansion to 82 octets, three blocks are needed. Every HMAC uses the same PRK key. Its message consists of the previous full block (empty for T0), info and one counter octet 01, 02 or 03. The stream concatenates generated blocks in order before final truncation.Each block depends on the previous blockExample: SHA-256 · L = 82 · N = 3Previous blockT(2) · 32 octetsContextinfo1 octet0x03message: concatenateSame PRKHMAC-HashkeyT(3)32 bytesT(1)T(2)T(3)Stream before truncation · counter is not ASCIIT(0) = zero-length string · PRK key does not change
03
Continue the chain with the next counter.

The third HMAC message uses T(2), info and byte 03. The output stream begins T(1) | T(2) | T(3); length selection is a separate final operation.

Source for this drawing: RFC 5869 · Read RFC section 2.3 ↗

Protocol participantThreat or exceptionProtocol controlSimplified drawings · precise section references
New to this? Start hereA quick picture + helpful background

A message needs an address.

Think of a packet as a small addressed envelope. Devices pass it onward; transport protocols decide what delivery promises an application gets.

Helpful first, if these ideas are unfamiliar

These pictures are analogies to help you learn. The linked RFC explains the actual rules.

Terms in this drawing
T(i)
The ith HashLen-octet expansion block.
Concatenation
Joining byte strings in order.
Related RFCs and changes

“Updates” changes part of an earlier RFC. “Obsoletes” replaces it. This list shows selected related documents.

KEY POINT

T(0) is the empty string. T(1) = HMAC-Hash(PRK, info | 0x01); the omitted T(0) contributes zero bytes.

  • T(0) is the empty string. T(1) = HMAC-Hash(PRK, info | 0x01); the omitted T(0) contributes zero bytes.
  • T(2) = HMAC-Hash(PRK, T(1) | info | 0x02). Further blocks use the immediately previous block, the same info and the next counter octet.
  • The vertical bar denotes byte concatenation, not an OR operation. The counter is one binary octet, not a decimal string, ASCII digit or four-byte integer.
  • N = ceil(L / HashLen) blocks are concatenated; take the first L octets. The output limit 255 × HashLen prevents wrapping the one-octet counter past 0xff.
DETAILS

This schematic SHA-256 example requests L=82 octets, so N=3. Every block is 32 octets and every HMAC call is keyed with the same PRK. info can be empty. Reported editorial erratum 5161 remains unverified; no counter wrap or modulo-extension algorithm is adopted. The published equations and 255-block bound already determine the counters used here.

Read the RFC section ↗

All chapters in RFC 5869

Drawing view

Scroll the drawing to see every part. Playback controls stay above it.

RFC 9700 / CHAPTERS

Chapters

For full details, tables, algorithms, and exceptions, read the original RFC.

RFC status and corrections ↗