Browser Labs

HKDF Key Derivation

Run RFC 5869 HKDF-Extract and HKDF-Expand with HMAC-SHA-256.

$ HKDF (HMAC-based key derivation) Read HMAC & Derivation Guide

Derive subkeys from a master key using HKDF-Extract and HKDF-Expand with HMAC-SHA-256.

PRK (extract)
-
OKM (expand)
-
Understanding HKDF
What is HKDF?

HKDF (HMAC-based Key Derivation Function) is a standardized method for deriving multiple cryptographic keys from a single master secret. It's used in TLS, VPNs, and secure messaging protocols.

Two-Phase Process:
  • 🔵 Extract: Converts input keying material (IKM) to a pseudorandom key (PRK) using HMAC-SHA-256
  • 🟢 Expand: Derives output keying material (OKM) from PRK using HMAC-SHA-256
Prefill Examples:
  • • TLS Key Derivation: Standard TLS 1.2 key expansion process
  • • Encryption Keys: Deriving encryption keys from Diffie-Hellman shared secrets
  • • Authentication Keys: Creating authentication keys with random salts
  • • Session Keys: Generating longer session keys for extended sessions
Security Benefits:
  • • Prevents key reuse attacks through unique salts and context
  • • Ensures cryptographic separation between different key purposes
  • • Provides forward secrecy when used with ephemeral keys
  • • Standardized and well-vetted by the cryptographic community
01
Why This Matters & 30-Second Experiment
Tap to expand plain-English guide & CLI command
Why This Matters

HKDF (RFC 5869) turns raw input key material into independent, domain-separated cryptographic keys in two stages: Extract (concentrating entropy with a salt) and Expand (binding each derived key to a unique context info string).

Try This 30-Second Experiment
  1. Enter input key material, an optional salt, and a context info label such as "tls-1.3-handshake".
  2. Change a single character in the info field to derive a completely independent key from the same master secret.
  3. Adjust output byte length to inspect multi-block HKDF-Expand output.
Run RFC 5869 HKDF-SHA256 in Node.js
node -e "const c=require('crypto'); console.log(Buffer.from(c.hkdfSync('sha256','ikm','salt','info',32)).toString('hex'))"
02
Visual Diagram, Guide & History
Tap to expand visual architecture & references
How It Works Visually
PasswordUnique SaltArgon2idMemory-hard KDFStoredHash + Salt