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

Quick quiz

Test yourself on scrypt

10 multiple-choice questions. Pick an answer for each, then submit to see explanations.

  1. Q1.Who designed scrypt?

  2. Q2.RFC that standardizes scrypt:

  3. Q3.scrypt's three cost parameters:

  4. Q4.Memory cost of scrypt is roughly:

  5. Q5.scrypt internal primitive:

  6. Q6.Cryptocurrency that uses scrypt:

  7. Q7.What is ROMix?

  8. Q8.scrypt's first deployment:

  9. Q9.scrypt vs Argon2id for new designs:

  10. Q10.At N=2^15, r=8, scrypt uses approximately:

0 of 10 answered