Derive un cryptographic clé de un mot de passe utilisant un KDF
Turn un human-memorable mot de passe en un fixed-longueur clé suitable pour AES ou HMAC utilisant PBKDF2, scrypt, ou bcrypt avec un salt.
- 1
Passwords are low-entropy and variable-length; cryptographic keys need high entropy and fixed length. A key derivation function (KDF) bridges this gap by stretching the password through many iterations, with a salt to defeat rainbow tables.
- 2 Dérivation de clé PBKDF2 →
Enter the password, a random salt, iteration count (100k-600k for PBKDF2-SHA256), and output length (32 bytes for AES-256). The tool outputs the derived key as hex or Base64.
- 3 Dérivation de clé scrypt →
For stronger protection against GPU/ASIC attacks, use scrypt which is memory-hard. Parameters: N=2^16-2^20, r=8, p=1. The memory cost makes parallel brute force expensive.
- 4
Store the salt and parameters (iterations, N/r/p) with the encrypted data — they are not secret. Only the password is secret. The same parameters + salt + password always reproduce the same key.
Questions fréquentes
- PBKDF2 vs scrypt vs bcrypt — which should I use?
- scrypt is strongest against hardware attacks (memory-hard). bcrypt is battle-tested for password storage. PBKDF2 is FIPS-standard and widely available. For key derivation specifically, scrypt or PBKDF2-SHA256 are standard choices; bcrypt is designed for password hashing, not key derivation.
- Why is the salt not secret?
- The salt's job is to ensure different users with the same password get different keys, and to defeat precomputed rainbow tables. It only needs to be unique and random, not secret. Store it alongside the derived key or ciphertext.