{
  "id": "wire-format/key-derivation",
  "family": "wire-format",
  "slug": "key-derivation",
  "title": "Key derivation functions (PBKDF2, scrypt, Argon2, HKDF)",
  "summary": "Key derivation functions (KDFs) derive cryptographic keys from a password or shared secret. PBKDF2: applies a pseudorandom function (HMAC) repeatedly (iterations) with a salt. scrypt: memory-hard (uses large memory to resist GPU/ASIC attacks). Argon2: winner of the Password Hashing Competition (2015), memory-hard, with variants (Argon2d, Argon2i, Argon2id). HKDF: extract-then-expand for deriving keys from a shared secret (not password-based).",
  "kind": "wire-format",
  "aliases": [
    "Key derivation functions (PBKDF2, scrypt, Argon2, HKDF)"
  ],
  "status": "standard",
  "verification": "verified",
  "tier": "B",
  "source_url": "https://en.wikipedia.org/wiki/Key_derivation_function",
  "source_version": "retrieved 2026-05-29",
  "retrieved_date": "2026-05-29",
  "ext_type": "wire-format@1",
  "ext": {
    "spec": "RFC 2898 (PBKDF2), RFC 7914 (scrypt), RFC 9106 (Argon2)",
    "summary": "Key derivation functions (KDFs) derive cryptographic keys from a password or shared secret. PBKDF2: applies a pseudorandom function (HMAC) repeatedly (iterations) with a salt. scrypt: memory-hard (uses large memory to resist GPU/ASIC attacks). Argon2: winner of the Password Hashing Competition (2015), memory-hard, with variants (Argon2d, Argon2i, Argon2id). HKDF: extract-then-expand for deriving keys from a shared secret (not password-based).",
    "structure": [
      {
        "field": "PBKDF2",
        "size": "function",
        "meaning": "DK = T_1 || T_2 || ... || T_dklen/hlen, where T_i = F(password, salt, c, i) and F = U_1 XOR U_2 XOR ... XOR U_c, U_1 = PRF(password, salt || INT(i)), U_j = PRF(password, U_{j-1})."
      },
      {
        "field": "PBKDF2 params",
        "size": "config",
        "meaning": "PRF (HMAC-SHA256), salt (>= 128 bits), iterations (>= 100000 for passwords), key length."
      },
      {
        "field": "scrypt",
        "size": "function",
        "meaning": "Memory-hard: uses ROMix (random memory access) and BlockMix. Params: N (CPU/memory cost, power of 2), r (block size), p (parallelism)."
      },
      {
        "field": "Argon2",
        "size": "function",
        "meaning": "Memory-hard with time cost (t), memory cost (m), parallelism (p). Variants: Argon2d (data-dependent, faster, GPU-resistant), Argon2i (data-independent, side-channel resistant), Argon2id (hybrid, recommended)."
      },
      {
        "field": "HKDF",
        "size": "function",
        "meaning": "Extract: PRK = HMAC-Hash(salt, IKM). Expand: OKM = T_1 || T_2 || ... where T_i = HMAC-Hash(PRK, T_{i-1} || info || i)."
      },
      {
        "field": "HKDF params",
        "size": "config",
        "meaning": "Hash (SHA-256), salt (optional), IKM (input key material), info (context), output length."
      }
    ],
    "example_hex": "00 00 00 00",
    "example_decoded": "KDF (placeholder)",
    "notes": [
      "PBKDF2 is the oldest (RFC 2898, 2000) but not memory-hard (vulnerable to GPU/ASIC).",
      "scrypt (RFC 7914) is memory-hard but complex to tune.",
      "Argon2 (RFC 9106) is the recommended password hashing function (PHC winner).",
      "HKDF is for deriving keys from a shared secret (not passwords). Used in TLS 1.3, Signal Protocol.",
      "Password hashing should use Argon2id with appropriate parameters (m=64MB, t=3, p=4)."
    ]
  },
  "updated": "2026-05-29"
}
