Skip to content
uencoder

scrypt

scrypt is a memory-hard KDF designed by Colin Percival that resists GPU/ASIC parallel brute force through large memory requirements, used for password hashing and key derivation.

Purpose

It adds memory hardness on top of CPU hardness, sharply raising the cost of specialized-hardware (ASIC) attacks.

Mechanism

It builds on PBKDF2 and ROMix (BlockMix randomly accesses a filled array in memory). Parameters: N (memory/time cost), r (block size), p (parallelism); it allocates about N×r×128 bytes of memory. Common settings: N=2^15, r=8, p=1.

Use cases

  • Litecoin mining
  • Tarsnap backup encryption
  • Password hashing (a bcrypt alternative)
  • ETH 2.0 key derivation

Examples

  • Input
    password, salt, N=2^15, r=8, p=1
    Output
    256-bit key

    Needs about 32 MB of memory

Common errors

An N value too low loses the memory-hard property
Tune per environment; N≥2^15 recommended for servers

Related terms

Related tools

References