scrypt
scrypt is a memory-hard KDF designed by Colin Percival that resists GPU/ASIC parallel brute force through large memory requirements, used for password hashing and key derivation.
Purpose
It adds memory hardness on top of CPU hardness, sharply raising the cost of specialized-hardware (ASIC) attacks.
Mechanism
It builds on PBKDF2 and ROMix (BlockMix randomly accesses a filled array in memory). Parameters: N (memory/time cost), r (block size), p (parallelism); it allocates about N×r×128 bytes of memory. Common settings: N=2^15, r=8, p=1.
Use cases
- Litecoin mining
- Tarsnap backup encryption
- Password hashing (a bcrypt alternative)
- ETH 2.0 key derivation
Examples
- Input
password, salt, N=2^15, r=8, p=1Output256-bit keyNeeds about 32 MB of memory
Common errors
- An N value too low loses the memory-hard property
- Tune per environment; N≥2^15 recommended for servers
Related terms
PBKDF2
PBKDF2 (Password-Based Key Derivation Function 2) is the KDF standardized in PKCS#5 that derives keys from passwords via iterated HMAC, widely used for password hashing and key derivation. GLOSSARY
Key Derivation
Key derivation is the process of generating encryption keys from low-entropy passwords or high-entropy master keys, using KDFs (e.g., PBKDF2, scrypt, Argon2) to raise the cost of brute force. GLOSSARY
Salt
A salt is a random value added during password hashing so identical passwords produce different hashes, defeating rainbow tables and same-password detection. GLOSSARY