wire / wire-format / key-derivation
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).
aka: Key derivation functions (PBKDF2, scrypt, Argon2, HKDF)
spec: RFC 2898 (PBKDF2), RFC 7914 (scrypt), RFC 9106 (Argon2)
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).
| field | size | meaning |
|---|---|---|
| PBKDF2 | function | 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}). |
| PBKDF2 params | config | PRF (HMAC-SHA256), salt (>= 128 bits), iterations (>= 100000 for passwords), key length. |
| scrypt | function | Memory-hard: uses ROMix (random memory access) and BlockMix. Params: N (CPU/memory cost, power of 2), r (block size), p (parallelism). |
| Argon2 | function | 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). |
| HKDF | function | Extract: PRK = HMAC-Hash(salt, IKM). Expand: OKM = T_1 || T_2 || ... where T_i = HMAC-Hash(PRK, T_{i-1} || info || i). |
| HKDF params | config | Hash (SHA-256), salt (optional), IKM (input key material), info (context), output length. |
example:
00 00 00 00
KDF (placeholder)
agent: curl -H 'accept: application/json' wire.phall.io/wire-format/key-derivation
or /wire-format/key-derivation.json