Skip to content
Blazeco.in
Journal

What Is Scrypt? The Algorithm Behind Litecoin and Dogecoin

7 min read
Five graphics cards in a cryptocurrency mining rig

Scrypt is a memory-hard password hashing function that Colin Percival created in 2009 for the Tarsnap backup service, and that the IETF published as RFC 7914 in August 2016. Crypto adopted it as a mining algorithm in 2011: Tenebrix first, then Litecoin, which hashes every block header with scrypt at N=1024, r=1 and p=1, using a 128 KB scratchpad per hash.

This guide explains what the scrypt algorithm does, what its three settings mean, how scrypt mining differs from Bitcoin’s SHA-256, and which coins used it, including Blazecoin, the 2014 coin this site documents.

What is the scrypt algorithm?

Scrypt is a password-based key derivation function: it turns a password and a salt into a derived key, and it is built to be costly on purpose. RFC 7914 is titled “The scrypt Password-Based Key Derivation Function”. Its defining trait is that it needs a large block of memory to compute, which makes large-scale brute-force attacks with custom hardware expensive.

Percival’s paper names two jobs for a key derivation function: hashing stored passwords, so that a stolen password file does not reveal the passwords, and generating keys for encryption or for authenticating data.

Percival’s paper calls this property “sequential memory-hard”. The idea is that an attacker trying billions of password guesses has to pay for memory, not just for computing power. Older functions such as PBKDF2 need very little memory, so they are cheap to run on custom chips and FPGAs.

Scrypt parameters: what do N, r and p mean?

RFC 7914 defines three tuning settings. Each one changes how much work and memory a single scrypt hash costs.

  • N is the CPU and memory cost. It must be a power of 2 and larger than 1.
  • r is the block size. The inner loop stores N blocks of 128 x r bytes, so the number of bytes of memory used is about 128 x r x N.
  • p is the parallelization setting: how many independent copies of the work run side by side.

For password storage, the RFC says r=8 and p=1 appear to give good results. Litecoin uses much lighter settings for mining.

Setting Litecoin value What the RFC says
N (cost) 1024 Power of 2, larger than 1
r (block size) 1 RFC suggests r=8 for passwords
p (parallelization) 1 RFC suggests p=1
Memory per hash 128 KB About 128 x r x N bytes
Output 256 bits Compared with the block target

Raising r from 1 to 8 at the same N would take the memory needed from 128 KB to 1 MB per hash. Wikipedia describes the version used for mining as a simplified form of scrypt.

How does scrypt mining work?

Mining with scrypt works like Bitcoin mining with a different hash. A miner takes the block header, runs it through scrypt, and checks whether the result is below the network’s target. If not, the miner changes the nonce and tries again.

In Litecoin’s source code, the proof-of-work hash for each block header is computed by a function named scrypt_1024_1_1_256. The name spells out the settings: N=1024, r=1, p=1 and a 256-bit output. The code reserves a 131,072-byte scratchpad, which is the 128 KB from the table above.

Gold-coloured Dogecoin novelty coin on a dark background
A physical Dogecoin novelty coin. Dogecoin has used scrypt-based mining since its launch in December 2013. Photo: Cyril Ernst, Wikimedia Commons, CC BY-SA 4.0.

Scrypt vs SHA256: what is the difference?

SHA-256 is the hash Bitcoin uses for proof of work, applied twice. The Bitcoin white paper describes proof of work as scanning for a value that, when hashed with something like SHA-256, starts with enough zero bits, and it budgets for a new block every 10 minutes.

SHA-256 Scrypt
Designed as General-purpose hash Password key derivation function
Published NIST standard 2009 paper, RFC 7914 in 2016
Memory needed Very little 128 KB per hash in Litecoin
Proof-of-work coins Bitcoin (applied twice) Litecoin, Dogecoin, Blazecoin
Typical block time Bitcoin: 10 minutes Litecoin 2.5 min, Dogecoin 1 min

The practical difference is memory. Every scrypt hash in progress needs its own scratchpad, 128 KB in Litecoin, while SHA-256 needs almost none.

Scrypt vs bcrypt and PBKDF2

Before scrypt, the common password functions were bcrypt and PBKDF2. Percival’s paper compares the cost of a brute-force attack on each, using his 2009 estimates of custom hardware prices. For interactive logins, he estimated scrypt was 35 times more expensive to attack than bcrypt and 260 times more expensive than PBKDF2.

The paper itself warns that those dollar figures could be off by a factor of 10 either way. They are useful for comparing the functions with each other, not as real prices today.

Did scrypt keep ASICs out?

That was the hope. According to Motherboard, quoted on Wikipedia, Litecoin chose scrypt because it theoretically prevents specialised chips, though that claim was debated at the time. With 128 KB per hash, Litecoin’s memory barrier is far lower than the 1 MB the RFC settings for passwords would need at the same N.

In practice, scrypt mining moved to graphics cards. Rising prices for scrypt coins in November and December 2013 led to shortages of high-end graphics cards.

Which coins use scrypt?

  1. Tenebrix (September 2011) replaced the SHA-256 rounds in Bitcoin’s code with scrypt. It was the first coin to do so.
  2. Fairbrix, a version of Tenebrix created by Charlie Lee.
  3. Litecoin, released by Charlie Lee on GitHub on 7 October 2011, with 2.5-minute blocks.
  4. Dogecoin, launched on 6 December 2013 with scrypt-based mining and 1-minute blocks.
  5. Blazecoin, a Litecoin fork from May 2014 with 30-second blocks, built to fund volunteer fire departments. Its full specs are in the Blazecoin history.

Many smaller scrypt coins from 2013 and 2014 are no longer traded. To check whether an old coin still has a working network, see our guide to dead coins and how to spot one.

Is scrypt still used for passwords?

Yes. Scrypt was a password function before it was a mining algorithm, and RFC 7914 describes it for exactly that use, with parameters you tune to your hardware. Tarsnap, the backup service it was written for, publishes the reference code under a 2-clause BSD licence.

If you are choosing settings for a password system, take them from the RFC and current guidance, not from crypto coins. Litecoin’s mining settings use an eighth of the memory the RFC’s suggested r=8 would at the same N.

Scrypt FAQ

Is scrypt better than SHA-256?

They do different jobs. SHA-256 is a fast general-purpose hash, which Bitcoin applies twice for proof of work. Scrypt is a password-based key derivation function built to be slow and memory hungry, which makes custom hardware more expensive to build.

Which cryptocurrencies use scrypt?

Tenebrix was first in September 2011, followed by Fairbrix and Litecoin. Dogecoin, launched in December 2013, and Blazecoin, launched in May 2014, also used scrypt for mining.

What do N, r and p mean in scrypt?

N is the CPU and memory cost and must be a power of 2. r sets the block size. p sets how many independent computations run in parallel. Memory use grows with N times r.

What scrypt settings does Litecoin use?

Litecoin hashes each block header with scrypt using N=1024, r=1 and p=1, which needs a 128 KB scratchpad per hash.

Can you still mine scrypt coins with a GPU?

Scrypt coins were mined on graphics cards in 2013, which caused shortages of high-end cards. Whether it pays today depends on current network difficulty, coin prices and power costs, so check those before buying any equipment.

Sources: Colin Percival, “Stronger Key Derivation via Sequential Memory-Hard Functions” (Tarsnap); RFC 7914; Litecoin source code (src/crypto/scrypt.cpp, src/primitives/block.cpp) on GitHub; the Bitcoin white paper and Bitcoin Core source; Wikipedia entries on scrypt, Litecoin and Dogecoin for launch history. All checked 17 November 2026. Header photo: Jasper Reichardt, Wikimedia Commons, CC BY-SA 4.0, cropped. More from Blazeco.in: home, journal.