scrypt
Colin Percival's memory-hard key derivation function, standardised in RFC 7914
Overview
scrypt is a password-based key derivation function designed by Colin Percival in 2009 to make large-scale hardware attacks costly by requiring substantial memory. It is specified in RFC 7914 and is widely used in password storage, disk encryption and cryptocurrencies.
scrypt first stretches the password and salt with PBKDF2-HMAC-SHA256 into p blocks. Each block is processed by ROMix: a sequence of N pseudo-random blocks is generated with the BlockMix function built on Salsa20/8 and stored in memory, then N data-dependent lookups into that sequence are mixed back into the state. The outputs are recombined with PBKDF2 to produce the key. The parameters N (cost), r (block size) and p (parallelism) set memory and time.
Memory use is roughly 128·N·r bytes. Litecoin and several other cryptocurrencies use scrypt with very small parameters as a proof-of-work function, which should not be confused with password-hashing settings. Typical interactive settings start around N = 2^15 to 2^17 with r = 8 and p = 1, adjusted to the time and memory budget of the server. The memory cost is what makes custom cracking hardware expensive.
History
2009–2016scrypt published by Colin Percival
Specified in RFC 7914
Security notes
scrypt is secure when tuned with sufficiently large N. Its data-dependent memory access can leak timing information through cache side channels, which Argon2id avoids. Parameters that were adequate in 2009 are too low today.
Typical uses
Variants in NextSSL
1| Algorithm | Tier | Sizes (bytes) | Standards | API |
|---|---|---|---|---|
| scrypt scrypt |
standard | out 16–1024 · salt 0–64 | RFC 7914 | safe |
Frequently asked questions
Which scrypt variants does NextSSL include?
NextSSL registers 1 scrypt variant: scrypt.
Families with similar names
Other password hashing
All 30Related
The Password Hashing Competition winner: memory-hard hashing standardised in RFC 9106
PBKDF2The iterated-HMAC password-based key derivation function from PKCS #5 and NIST SP 800-132
yescryptAn scrypt-derived memory-hard password hash, now the default in many Linux distributions
Salsa20Bernstein's eSTREAM-portfolio ARX stream cipher and the core of scrypt and NaCl