Pcornel
Browse topics
Options
Recent
Favorites
Security · Technical reference

scrypt

Direct answer

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.

When to use this

Use this when using scrypt for passwords or key derivation.

First 30 seconds

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.

Operational verification

password + salt + N,r,p → scrypt

Context & applicabilityCommon mistakes · platform/version boundaries
Common mistakes
Common mistakes
  • 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.scrypt failing with memory errors when maxmem is not raised.
Platform / version applicability
Cryptography, PKI and secrets
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

PlatformCryptography, PKI and secrets
Scope / prerequisiteUse this when using scrypt for passwords or key derivation.
What next?2 suggested next steps
Evidence1
On this pageJump to a specific section
Evidence references

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.

observation · 1
Key points
  • scrypt is memory-hard.
  • It is tuned with N, r and p.
  • It resists GPU cracking well.
Key checks
  • 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

ParameterMeaningTypical
NCPU/memory cost (power of 2)2^17
rBlock size8
pParallelisation1

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:

ParameterMeaningTypical value
NCPU/memory cost (power of 2)2^17
rBlock size8
pParallelisation1

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.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Technical verification history

Verification history & basis

When and against what this Topic was checked. Later text edits do not count as a new check.

2026-09-14 · vendor docCryptography, PKI and secrets current

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%
Confirmation

Confirm action

Continue?