在线实验室

HKDF 密钥派生

在浏览器本地测试哈希摘要、文件校验、默克尔证明与密钥派生。

$ 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