Hash Lab

Password hashing / KDF

scrypt

Designed by Colin Percival (BSDCan 2009, RFC 7914 in 2016). scrypt was the first widely-deployed memory-hard password hashing function; it spawned the Password Hashing Competition that eventually produced Argon2. Still a sound choice when an implementation is at hand and you want CPU + memory cost.

At a glance

OutputConfigurable (typically 32 bytes)
Cost parametersN (CPU/memory cost, power of 2), r (block size), p (parallelism)
Memory cost~128 · N · r bytes
Internal primitivePBKDF2-HMAC-SHA-256 + Salsa20/8 + ROMix
StandardRFC 7914 (2016)
StatusSound; prefer Argon2id for new designs

Cost parameters

At N = 215, r = 8 scrypt uses about 32 MiB per invocation. That was enormous in 2009 and still inconvenient for GPU attackers, but Argon2id can be pushed much higher.

Where it is used

How it works

scrypt stretches the password with PBKDF2-HMAC-SHA-256, then feeds the output into ROMix: build a large array of Salsa20/8 outputs, then read from it in a sequence determined by the latest array element. The sequential write-then-shuffle is the memory-hardness lever , you can’t trade time for space because each read depends on a value you must have already computed.

Try it

The KDF Lab includes scrypt with interactive N, r, p sliders.

References

Generate

Run scrypt on your input

16 bytes

15

8

1

Test Your Knowledge

Quick MCQ check on this algorithm

Start Quiz →

AI Summary

Summarize this page in your favorite LLM