What Is SHA-256? The Hash Function Behind Bitcoin Explained
On this page
What is SHA-256? The question comes up early for anyone learning about bitcoin, because the name is everywhere: in mining, in transaction IDs, in addresses, in ads for mining machines and in offers to "recover your wallet". SHA-256 is a hash function, an algorithm that turns any piece of data into a fixed-size fingerprint and that was designed not to be undone. This post explains, using standards from NIST, the US standards institute, bitcoin's developer documentation and official alerts read on 26/11/2026, what SHA-256 is, where bitcoin uses it, why it is so hard to break, what quantum computing changes and which scams borrow the name.
In short
- SHA-256 is a hash function defined by NIST, first published in August 2002 and now specified in FIPS 180-4. The output is always 256 bits, or 64 hexadecimal characters.
- A hash is not encryption: there is no key and no "decrypt". Changing one letter of the input changes the whole result.
- Bitcoin uses SHA-256 in mining, in the TXID, in each block's Merkle tree and in legacy addresses.
- According to NIST, SHA-256 provides 128 bits of security against collisions and 256 bits against preimage attacks. No known attack breaks the full version.
- The quantum risk most often cited for bitcoin sits in its elliptic curve signatures, not in SHA-256. NIST says hash functions should remain usable in a quantum era.
| Term | What it is | What it is not |
|---|---|---|
| SHA-256 | A hash function with a fixed 256-bit output | A way to hide data that a password later unlocks |
| Hash | A fingerprint of a piece of data | A compressed copy you can unzip |
| Collision | Two different inputs with the same hash | Something anyone has found for SHA-256 |
| Preimage | Finding an input from its hash | A task feasible with today's computers |
| sha256d | SHA-256 applied twice, used by bitcoin | A different algorithm from SHA-256 |
What a hash function is
NIST's FIPS 180-4 standard describes the SHA family as "one-way hash functions" that process a message "to produce a condensed representation called a message digest". Put simply: you feed in anything, from a single word to an entire file, and get back a fixed-size summary. For SHA-256, that summary is 256 bits long, shown as 64 hexadecimal characters.
The same standard says that "any change to the message will, with a very high probability, result in a different message digest". In practice the change is total. The SHA-256 of the word "bitcoin", in lowercase, starts with 6b88c087; the hash of "Bitcoin", capitalised, starts with b4056df6. One letter apart, and nothing in the output helps you guess the input.
A NIST glossary entry sums it up with an image: "A hash function can be considered to be a fingerprint of the file or message." A fingerprint identifies the data without containing it.
That is why a hash is not encryption. The same glossary defines encryption as changing plaintext into ciphertext "using a cryptographic algorithm and key", a process that whoever holds the key can reverse. A hash has no key and no way back. Websites that promise to "decrypt SHA-256" simply look the hash up in tables of hashes of known words; if the input was a common word, it shows up, and if it was not, there is nothing to decode.
SHA-256 belongs to the SHA-2 family. The first standard for the family, FIPS 180-2, was published in August 2002. The patent describing the algorithm was filed by the US National Security Agency in 2001, and the standard was published by NIST.
The three properties that matter
NIST's hash functions page lists three security properties:
- Preimage resistance: given a hash, it is "computationally infeasible" to find an input that produces it.
- Second preimage resistance: given an input, it is infeasible to find a different one with the same hash.
- Collision resistance: it is infeasible to find any two different inputs with the same hash.
NIST's wording is "computationally infeasible", not "impossible". The difference matters: in theory collisions exist, because there are infinitely many possible inputs and a finite number of outputs. Security means that finding one would take more work than any known computer can do.
Get the Seed backup checklist
The seed is the wallet. A bad backup only shows up on the day you need it. Check every item before moving meaningful value into self-custody. Along with it, Vault alerts on the Security and self-custody topic.
Where bitcoin uses SHA-256
Bitcoin uses SHA-256 in four places, almost always applied twice in a row, which the documentation calls sha256d.
Mining. The whitepaper describes proof of work as scanning for a value that, "when hashed, such as with SHA-256, the hash begins with a number of zero bits". The current technical rule, per bitcoin's developer documentation, is that the block header hash must be at or below a target. Miners try trillions of combinations per second until one produces a small enough hash. Finding it is expensive; checking it costs a single hash. How this compares with staking is covered in Proof of work vs proof of stake: differences and risks.
Chaining blocks. Each block header carries the hash of the previous block. Per the documentation, this ensures no earlier block can be changed without also changing the next header. Altering an old transaction would mean redoing the proof of work for every block after it.
TXID. Bitcoin's glossary defines the transaction ID as "the sha256d hash of the transaction". It is the 64-character code an exchange asks for when a deposit does not arrive, explained in Transaction Hash (TXID): What It Is and How to Use It.
Merkle tree and addresses. The TXIDs in a block are paired and run through double SHA-256 until a single hash remains, the Merkle root, stored in the header. In legacy addresses, the ones starting with 1 and 3, the public key goes through SHA-256 and then another hash, RIPEMD-160. Taproot addresses, starting with bc1p, use a different format.
Ethereum takes a different route. On its execution layer, where addresses and contracts live, it uses Keccak-256, the version of the algorithm that won the competition behind SHA-3, which differs from the SHA3-256 standardised by NIST. SHA-256 does appear in Ethereum's consensus layer and in the staking deposit contract.
Why there is no way back
According to NIST's tables, SHA-256 provides 128 bits of security against collisions and 256 bits against preimage attacks. Finding a collision by brute force would take about 2^128 operations on average; finding the input behind a hash, about 2^256.
The number 2^256 has 78 digits, roughly 1.16 x 10^77. For scale: bitcoin's entire mining network, the largest concentration of SHA-256 computing power in the world, ran at about 1,000 EH/s, or 1 zettahash per second, according to the block explorer mempool.space on 26/11/2026. By our own arithmetic, at that pace the whole network would need about 10 billion years to reach 2^128 attempts and something in the order of 10^48 years for 2^256. These are order-of-magnitude illustrations, not forecasts.
Academic research attacks reduced versions of the algorithm, with fewer rounds. According to the Ethereum Foundation, writing on 24/11/2026, the best collision attacks reach 38 of SHA-256's 64 rounds. The full version, the one bitcoin uses, has no known attack that breaks it.
What this means for anyone holding crypto: your wallet's security does not depend on whether someone can reverse SHA-256. It depends on your private key and seed phrase staying secret, which is the subject of What is a seed phrase and how to store 12 or 24 words.
Quantum computing: what threatens the hash and what threatens the signature
"Is SHA-256 quantum resistant?" is one of the top searches on the subject. The answer has two parts, because bitcoin relies on two different things: hashes and signatures.
The hash. The quantum algorithm that attacks hashes, Grover's, offers at most a square-root speed-up. NIST's post-quantum cryptography FAQ, updated on 27/10/2026, says: "We don't know that Grover's algorithm will ever be practically relevant, but if it is, doubling the key size will be sufficient to preserve security." NIST report IR 8105 concludes that hash functions "should be usable in a quantum era". NIST says it will issue guidance on a hash transition only when it can foresee the need.
The signature. What authorises spending a bitcoin is a digital signature, ECDSA or Schnorr, over the secp256k1 elliptic curve. Shor's algorithm, from 1994, efficiently solves the mathematical problem those signatures rely on. In NIST IR 8105, the ECDSA row reads "No longer secure" against a large-scale quantum computer. That, and not SHA-256, is where the quantum risk most often cited for bitcoin lies.
On 13/08/2024, NIST published three post-quantum standards, FIPS 203, 204 and 205; one of them, FIPS 205, is built on hash functions. In bitcoin, proposals exist but are drafts. BIP-360, now called Pay-to-Merkle-Root, and BIP-361, on migrating away from old signatures, both had Draft status on 26/11/2026, with no activation. Nobody knows when, or whether, a quantum computer able to break elliptic curves will exist, and this post makes no forecast.
Scams that borrow the name
SHA-256 shows up in two families of scams.
Fake recovery. People who lost crypto get approached by "experts" claiming they can crack hashes, keys or wallets. The FBI warns that these fraudsters "charge an up-front fee" and disappear after the first payment, and that "Private sector recovery companies cannot issue seizure orders to recover cryptocurrency". Between February 2023 and February 2024, victims of fictitious law firms reported more than US$ 9.9 million in losses, according to the FBI. The FTC, the US consumer protection agency, is blunt: "Don't pay anyone who contacts you, offering to recover money you lost to a scam." Anyone promising to brute-force SHA-256 is promising something NIST classifies as computationally infeasible.
Fake mining. In 2019, the SEC and the CFTC, the US securities and derivatives regulators, warned about fraudsters who claim to invest customers' money in "mining farms", promising guaranteed returns of 20% to 50%. On 13/02/2025, the US Department of Justice (DOJ) described the HashFlare case: according to the DOJ, the company sold more than US$ 577 million between 2015 and 2019, did not have the mining capacity it claimed, and the dashboard showing customers their profits "reflected falsified data". Not all cloud mining is fraud, but a guaranteed return is the red flag regulators point to.
What to check
- If someone offers to "crack" or "decode" your wallet's hash, treat it as a scam: no legitimate service does that.
- When you download a wallet, compare the file's SHA-256 with the one the project publishes; that is exactly why projects publish it.
- If the issue is a transaction, its TXID is the hash that identifies it, and anyone can look it up on an explorer; to follow the queue, see Bitcoin Transaction Pending? What mempool.space Shows You.
- If the topic is quantum computing, separate the hash from the signature, and be wary of anyone selling a "quantum-proof" token as the fix.
- If the offer is mining with a guaranteed return, know that this is the pattern the SEC and the CFTC flagged.
Where the idea of chaining blocks with hashes came from, decades before bitcoin, is in Who Invented Blockchain? The 1991 Paper Before Bitcoin, and who maintains the code that uses all this is in Open Source Crypto: What It Means and Who Controls the Code. The other topics in the series are in Crypto Technology Glossary: x402, NFTs, Lightning and More.
Crypto assets carry high risk, including significant volatility and the possibility of losing the capital invested, and no form of custody changes that. Vault Capital is a securities consultancy authorized by the CVM under CVM Resolution 19/2021 and works on the principle of advice, never custody: assets stay on the client's own exchanges and wallets. If you want to set up your own wallet with hands-on guidance, the Self-Custody Immersion is built for that, and the FAQ explains how Vault works without custody of client assets.
How miners use SHA-256 to produce blocks, and how much energy it takes, is covered in Bitcoin Mining Explained: How It Works and What It Costs.
Which coins would be exposed to a quantum computer, and how much each study estimates, is covered in Quantum Computing and Bitcoin: Which Coins Are Exposed.
Frequently asked questions
What is SHA-256?
It is a hash function, defined by NIST in FIPS 180-4, that turns any data into a fixed 256-bit result, shown as 64 hexadecimal characters. It works like a fingerprint: it identifies the data, changes completely if one letter changes and cannot be used to rebuild the input.
Can SHA-256 be decrypted?
No, because a hash is not encryption: there is no key and no way back. "Decrypt" websites only look hashes up in tables of known words. If the input was unique, such as a private key, no table contains it.
What does bitcoin use SHA-256 for?
Mining, where blocks need a hash below a target; the TXID, which is the double SHA-256 of the transaction; each block's Merkle tree; and legacy addresses starting with 1 or 3. The signatures that authorise spending use different maths, based on elliptic curves.
Has SHA-256 ever been broken?
No. Published attacks reach reduced versions, with up to 38 of 64 rounds, according to the Ethereum Foundation on 24/11/2026. According to NIST, the full version provides 128 bits of security against collisions and 256 against preimages.
Will quantum computers break SHA-256?
NIST's view is that hash functions should remain usable in a quantum era, at most with larger outputs. The quantum risk most cited for bitcoin is in its elliptic curve signatures, which Shor's algorithm would attack. Bitcoin's migration proposals, such as BIP-360, were drafts on 26/11/2026.
Do I need to keep transaction hashes for crypto taxes in Brazil?
Brazil's Receita Federal does not mention the TXID by name, but its 2026 income tax Q&A requires taxpayers to keep documentation proving the authenticity of purchase and sale values. The TXID is the most direct way to show a transaction happened on the blockchain, so keeping it alongside exchange statements helps.
Let's talk
Knowing what SHA-256 protects, and what it does not, helps you tell the maths from the scam. The part of security that depends on you lives in your key and your seed phrase. If you want to learn to set up and test your own wallet safely, Vault's Self-Custody Immersion teaches the process hands-on, in person, with the setup validated by a specialist.
Want to hold your crypto safely, on your own?
Vault's Self-Custody Immersion teaches wallets, seed backups and succession planning, hands on.
Learn about the ImmersionPath · Security and self-custody
Start the Security and self-custody path
Self-custody vs exchange: where to keep crypto in 2026
Self-custody vs exchange compared by counterparty risk, fees, Brazilian tax reporting and inheritance, with the FTX and Mt. Gox cases and a rule by amount.