Use this when using scrypt for passwords or key derivation.
scrypt
scrypt is a memory-hard password hashing and key derivation function, tuned with N, r and p parameters, designed to make large-scale hardware cracking costly.
1. scrypt is memory-hard (resists GPUs/ASICs).
2. Tune N, r, p.
3. Used in some systems and crypto wallets.
4. Watch memory on busy servers.
5. Argon2id is newer.
password + salt + N,r,p → scrypt
Context & applicabilityCommon mistakes · platform/version boundaries
- Parameters too small (N=2¹⁴ from old examples) for password storage.
- Setting N too large for the server's memory, allowing DoS through many logins.
- Python
hashlib.scryptfailing with memory errors whenmaxmemis not raised.
Operational reference
Fast context before you go deeper.
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
- scrypt is memory-hard.
- It is tuned with N, r and p.
- It resists GPU cracking well.
python3 -c "import hashlib;print(hashlib.scrypt(b'pw',salt=b'salt'*4,n=2**17,r=8,p=1).hex())"— scrypt example- Parameters N, r, p — memory/CPU cost
- Memory available on servers — sizing
ReferenceWhy it matters1 section · depth on demand
Parameters
| Parameter | Meaning | Typical |
|---|---|---|
| N | CPU/memory cost (power of 2) | 2^17 |
| r | Block size | 8 |
| p | Parallelisation | 1 |
Memory used ≈ 128 × N × r bytes (2^17 × 8 → 128 MiB). Memory hardness makes GPU and ASIC attacks expensive. scrypt is used in some cryptocurrencies, Cisco type 9 passwords and as a KDF.
ReferenceImportant terms & boundaries1 section · depth on demand
In depth
scrypt is a memory-hard password hashing and key derivation function: computing it requires a configurable amount of memory as well as CPU time, which makes large-scale guessing on GPUs and ASICs much more expensive than with PBKDF2.
Parameters:
| Parameter | Meaning | Typical value |
|---|---|---|
| N | CPU/memory cost (power of 2) | 2^17 |
| r | Block size | 8 |
| p | Parallelisation | 1 |
With N=2^17 and r=8, each hash uses about 128 MiB of memory. scrypt is used in some cryptocurrency systems, disk encryption and applications; Argon2id is generally recommended for new password storage, with scrypt as a good alternative.
ReferenceConfiguration & state1 section · depth on demand
Example (Python)
import hashlib, os
salt = os.urandom(16)
dk = hashlib.scrypt(b'password', salt=salt, n=2**17, r=8, p=1, maxmem=256*1024*1024, dklen=32)
Documented example, not captured output. Memory use ≈ 128 × N × r bytes (128 MiB here). scrypt is also used as a KDF in some cryptocurrencies and disk encryption tools.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in Hashing → scrypt. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://csrc.nist.gov/pubs/fips/180-4/upd1/final · confidence 94%