← Glossary

Mining

What Is a Memory-Hard Function? Why Scrypt Needs So Much RAM

A memory-hard function is a hash designed so that computing it needs a large amount of memory as well as processing time, which raises the cost of building specialised hardware to run it quickly.

Key takeaways

The idea

Most hash functions need very little memory, so thousands of copies can be packed onto a chip. A memory-hard function deliberately fills a large working area with data and then reads from it unpredictably. Computing it fast requires lots of fast memory, and shrinking the memory makes it much slower. That lifts the cost per unit of work for anyone building specialised hardware.

Scrypt

Scrypt was designed by Colin Percival and published in 2009 for password-based key derivation, in the context of his Tarsnap backup service. It combines a hash-based construction with a large array that it fills and then reads back in a data-dependent order. Its parameters, usually written N, r and p, set the memory cost, block size and parallelism.

Scrypt in Litecoin and Dogecoin

Litecoin adopted Scrypt for its proof of work with small parameters. Its source code implements the function under the name scrypt_1024_1_1_256, which means N=1024, r=1 and p=1 with a 256-bit output, and Dogecoin uses the same function. At those settings the working memory is small enough that mining remained feasible on ordinary graphics cards.

What happened next

The hope was that memory hardness would keep mining on commodity hardware. In practice, dedicated Scrypt ASICs appeared and became the standard for serious mining, because with fixed small parameters a chip can include the needed memory directly. So memory-hardness raised the cost and delayed specialised hardware but did not stop it. Today a Scrypt miner buys an ASIC rated in MH/s or GH/s, and the profitability depends on power cost and the coin's price.

Example

A password hash such as scrypt is deliberately set to need, say, tens of megabytes per attempt so a thief with a graphics card can test far fewer guesses per second. Litecoin's mining use sets the memory much lower, to a size small enough for fast block verification.

Put it into practice

See what Scrypt hardware earns today

ASIC Scrypt miners earn from Litecoin and Dogecoin through merged mining. Enter your machine's hashrate and power use in the calculator to see the daily result.

Open the mining calculator Get Scrypt for Android

Frequently asked questions

Is Scrypt the same as the Litecoin algorithm?

Litecoin's proof of work uses the Scrypt function with N=1024, r=1, p=1. 'Scrypt coins' is shorthand for coins that use this algorithm.

Does memory-hard mean ASIC-proof?

No. Scrypt ASICs exist and dominate. Memory hardness raised the cost but did not prevent specialised hardware.

Why not use bigger parameters?

Every node must verify each block's hash, so large parameters would make validating the chain slow and expensive.

Related terms

Go deeper

Written by the Scrypt Wallet team · Updated 2026-10-02. General education, not financial, tax or legal advice.