← Cryptography

🧬 Key Derivation

Derive keys with PBKDF2 and HKDF.

PBKDF2 or HKDF?

PBKDF2 turns a low-entropy password into a key by repeating HMAC many times (OWASP: 600,000 iterations with SHA-256). HKDF is for input that is already high-entropy, such as an ECDH shared secret: extract condenses it into a pseudorandom key (PRK) with the salt, then expand stretches the PRK into keys bound to the info string. The BIP39 preset derives a wallet seed: PBKDF2-HMAC-SHA512, 2048 iterations, salt “mnemonic” + passphrase, 64 bytes.