← Glossary

Mining

What Is SHA-256? The Hash Function Behind Bitcoin Mining

SHA-256 is a cryptographic hash function from the SHA-2 family, defined in NIST's Secure Hash Standard, that produces a 256-bit digest and is used by Bitcoin for its proof of work, block hashes and merkle trees.

Key takeaways

What SHA-256 is

SHA-256 belongs to the SHA-2 family of hash functions published by the U.S. National Institute of Standards and Technology in its Secure Hash Standard, FIPS 180-4. It reads input in 512-bit blocks and produces a 256-bit digest, usually shown as 64 hexadecimal characters. It is used far beyond crypto, for certificates, software signatures and password systems.

How Bitcoin uses it

Bitcoin's proof of work requires the hash of a block header to be below a target. The developer documentation describes the hashing of transaction pairs in a merkle tree as SHA256(SHA256()), and the same double application is used for the header hash. Applying the function twice is a design choice that Bitcoin carries into its transaction IDs as well.

Why miners built specialised chips

Because SHA-256 needs only simple operations and little memory, it can be implemented very efficiently in dedicated silicon. That is why Bitcoin mining moved from general-purpose computers to purpose-built ASICs. Mining a different algorithm needs different machines: a SHA-256 ASIC cannot mine a Scrypt coin and the reverse.

SHA-256 and the Scrypt coins

Litecoin and Dogecoin do not use SHA-256 for their proof of work; they use Scrypt. They still use SHA-256-based hashing elsewhere in their inherited structures, such as merkle trees and transaction IDs. If you are choosing hardware, check which function the coin's proof of work uses before comparing hashrates, because hashrate numbers from different algorithms are not comparable.

Reading hashrate figures

Hashrate is measured in hashes per second of the algorithm in question. A SHA-256 machine rated in terahashes per second and a Scrypt machine rated in gigahashes per second are doing different work, so the numbers cannot be ranked against each other. Compare machines within the same algorithm, then compare their earnings after power cost.

Example

Hashing the empty string with SHA-256 gives a fixed 64-character value that begins e3b0c442. Hashing any other input gives a different 64-character value of the same length, which is why the digest is a fingerprint rather than a copy of the data.

Put it into practice

Match hardware to the algorithm

Hashrates only compare within one algorithm. The mining calculator is built for Scrypt machines and the coins they mine, such as Litecoin and Dogecoin.

Open the mining calculator Get Scrypt for Android

Sources and verification

Last reviewed 2026-10-02 by the Scrypt Wallet team. The factual claims on this page, and where each comes from:

  1. SHA-256 is defined in NIST FIPS 180-4, the Secure Hash Standard. [1]
  2. Bitcoin hashes pairs in the merkle tree with SHA256(SHA256()). [2]
  3. Cryptographic hash functions are designed to be one-way and collision resistant. [3]

Sources

  1. FIPS 180-4: Secure Hash Standard · NIST · primary source
  2. Bitcoin developer reference: Block chain · Bitcoin.org · primary source
  3. Cryptographic hash function · Wikipedia · secondary source

Primary sources are protocol papers, specifications, source code or a project's own documentation; secondary sources are wikis and explainers. We checked each claim against the source text on the review date. Found an error? Tell us and we will correct it.

Frequently asked questions

Is SHA-256 secure?

As of NIST's current standard it is an approved hash function with no practical collision or preimage attacks known. Security can change, so rely on current guidance.

Why does Bitcoin hash twice?

Bitcoin's design applies SHA-256 twice for block headers and merkle pairs; it is part of the protocol's definition.

Can I mine Litecoin with a SHA-256 miner?

No. Litecoin's proof of work is Scrypt, so you need hardware built for Scrypt.

Related terms

Go deeper

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