About this tool
scrypt was designed by Colin Percival in 2009 to make password cracking expensive in memory, not just time. It’s used for password storage, for deriving encryption keys from passphrases, and in several cryptocurrencies. This tool computes scrypt with any cost settings and shows the result as hex, Base64 and a PHC-style string.
Everything is computed in your browser with WebAssembly or the Web Crypto API. Your passwords and files are never uploaded.
The parameters
| Parameter | Meaning | Effect |
|---|---|---|
| N (cost) | Number of iterations; a power of two | Memory and time both grow linearly with N |
| r (block size) | Size of each memory block (128 × r bytes) | Memory and time grow with r; 8 is standard |
| p (parallelism) | Independent lanes | Multiplies time (or uses more cores) |
Memory needed is about 128 × N × r bytes: with N = 217 and r = 8, that’s 128 MiB. OWASP recommends at least N = 217, r = 8, p = 1 for password storage.
Storing scrypt hashes
Store the parameters and salt with each hash so you can verify and upgrade later. The PHC-style string $scrypt$ln=17,r=8,p=1$salt$hash (as used by Python’s passlib) does this in one field. For new systems, Argon2id is generally preferred; scrypt remains a solid choice and is built into Node.js (crypto.scrypt) and Python (hashlib.scrypt).
# Python (standard library)
import hashlib
key = hashlib.scrypt(password.encode(), salt=salt.encode(), n=2**17, r=8, p=1, maxmem=256 * 1024 * 1024, dklen=32)
// Node.js
crypto.scrypt(password, salt, 32, { N: 2 ** 17, r: 8, p: 1, maxmem: 256 * 1024 * 1024 }, (err, key) => {});
FAQ
What is scrypt?
A password-based key derivation function that requires a large amount of memory, making hardware-accelerated password cracking expensive.
What scrypt parameters should I use?
OWASP recommends at least N = 2^17 (131,072), r = 8 and p = 1, which uses 128 MiB of memory per hash.
Why does Node.js say “memory limit exceeded”?
Node limits scrypt to 32 MiB by default. Pass a larger maxmem option, such as 256 MiB, when you use N = 2^17 with r = 8.
scrypt vs Argon2?
Both are memory-hard. Argon2id is the newer standard with finer control; scrypt is older, widely available and still considered secure.