Research·Risk

If SHA-256 Were Broken

SHA-256 appears in almost every part of Bitcoin, and "broken" is not one event. A collision attack and a preimage attack would damage different things, on different timescales, with different remedies — and the part everyone worries about first is the part that would matter least.

Level
Advanced
Reading
8 min
Published
2026-11-28
Reviewed
2026-11-28

Bitcoin uses SHA-256 for mining, for linking blocks, for Merkle trees, inside addresses, and in every commitment scheme layered on top. A single function carrying that much weight is a reasonable thing to worry about. The useful version of the worry distinguishes between the ways it could fail, because they are not equivalent.

What does “broken” actually mean?

At least three different things, with very different consequences.

Collision resistance fails when somebody can find two inputs with the same hash. They do not get to choose what the inputs are, only that the pair collides.

Second-preimage resistance fails when, given one input, somebody can find a different input with the same hash. That is strictly harder and strictly more dangerous.

Preimage resistance fails when, given a hash, somebody can find an input producing it. That is the strongest break and the one that would reach the most places.

Historical breaks have overwhelmingly been collision attacks first, weakening over years, with preimage resistance holding far longer. MD5 and SHA-1 both followed that path, which is the pattern anyone assessing SHA-256 should expect rather than a sudden total failure.

Would mining break?

No. Mining is the use least affected, which surprises people.

Mining searches for an input whose hash falls below a target. A preimage attack — being able to invert the function — would make that search trivial, so blocks would be found instantly and difficulty would retarget upward until… nothing. The adjustment has a ceiling in the sense that a target can only go so low, and an attacker able to invert SHA-256 could mine every block.

But notice what that scenario requires: a full preimage break, which is the hardest of the three. A collision attack does nothing for a miner, because finding two inputs that agree is not finding one input below a threshold.

So the honest ordering is that mining is safe under collision attacks, safe under second-preimage attacks, and completely broken under a preimage attack — at which point the function’s failure is a problem for the entire internet rather than for Bitcoin specifically.

What would a collision attack reach?

The structures that commit to data, which is where the real exposure sits.

A Merkle root is a hash of hashes. If somebody can construct two different transaction sets with the same root, a block could be presented with contents that differ from what was committed to — and inclusion proofs, which every light client depends on, would stop proving inclusion.

Bitcoin already carries one such weakness without any break at all. A transaction with exactly 64 bytes of non-witness data can be read as either a leaf or an internal node, which allows a forged inclusion proof today. The consensus fix is specified and unactivated, and relay policy holds it off by refusing transactions below 65 non-witness bytes.

Beyond block structure, commitments are everywhere. Taproot’s tweak commits to a script tree; payment channels commit to states; every hashed timelock in a Lightning route commits to a preimage. A collision attack would need examining case by case, and several of those schemes would need redesigning rather than reparameterising.

What about addresses?

Partially protected by accident, because most of them hash twice.

Legacy and script addresses use HASH160 — SHA-256 followed by RIPEMD-160. Taproot output keys are the public key tweaked by a tagged SHA-256 hash, so the key itself is on the curve rather than behind a hash.

A collision in SHA-256 alone would not immediately let somebody spend your coins, because spending still requires a signature. What it could do is let an attacker construct a script that hashes to the same value as yours, which matters for arrangements where a hash commits to spending conditions rather than to a key.

The 160-bit output length is the other consideration. It is shorter, and generic collision search against 160 bits is far cheaper than against 256 — which is a known margin rather than a flaw, and is part of why newer output types moved away from it.

Why does Bitcoin hash twice?

Because the double application removes a specific weakness in the construction, and the reason is older than Bitcoin.

Nearly everywhere Bitcoin hashes, it hashes twice — SHA-256 applied to its own output. The family SHA-256 belongs to is built so that a hash can be extended: given the hash of a message, and without knowing the message, an attacker can compute the hash of that message with extra data appended. Hashing the result a second time breaks that property, because the second application’s input is a fixed-length digest rather than an extendable message.

Whether Bitcoin needed the defence everywhere it used it is debatable, and the habit cost nothing meaningful. What matters for this article is that it does not help against the breaks described above: two applications of a function with a collision attack still collide, because a collision in the first application produces identical input to the second.

So the double hash is a sensible belt-and-braces choice against one narrow attack and not a general margin of safety. It is frequently cited as though it were the latter.

Could Bitcoin migrate?

Yes in principle, slowly in practice, and the hard part is the coins that do not move.

Changing the hash used for mining is conceptually simple: a new function, a soft or hard fork, a new difficulty. It would obsolete every mining machine on earth, which is an enormous economic event and not a technical obstacle.

Changing the hashes inside addresses and scripts is harder, because existing outputs are locked to the old construction. Coins in those outputs would have to be moved to new ones by their owners, and coins whose owners are absent or dead would stay where they are, exposed to whatever the break allows.

That is the same shape as the quantum migration problem and it is worth noticing that both risks converge on the same operational answer: a scheduled migration window, loud and long, after which unmoved coins are at the mercy of the broken primitive. Nobody has specified one, and the activation question is what would make it slow.

Does the proof of work itself constrain a fix?

Yes, in a way that makes the mining case politically harder than the cryptography suggests.

Changing the mining function is the one migration where the technical work is easy and the constituency is unanimous in the wrong direction. Every machine in existence computes SHA-256 and nothing else, so a new function turns the entire global fleet into scrap on the day it activates.

That gives miners an overwhelming incentive to argue the break is not serious enough to act on, and it gives everyone else an incentive to act early. A disagreement of that shape, under time pressure, with the security of the chain degrading while it continues, is the scenario worth worrying about — more than the cryptanalysis itself.

It is also the argument for the change being a hard fork rather than a soft one. A soft fork tightening the proof of work would leave old nodes accepting blocks the new rules reject, which during a cryptographic emergency is exactly the wrong failure direction.

How likely is any of this?

Low, on current evidence, and not zero — and the relevant horizon is decades.

SHA-256 has been standardised since 2001, subjected to enormous cryptanalytic attention, and has no practical attack against it. Its predecessors fell gradually, with early distinguishers published long before practical collisions, so the community would expect warning rather than surprise.

NIST standardised SHA-3 in 2015 explicitly as insurance — a function built on an entirely different construction, so a structural break in one family would not imply a break in the other. That is the institutional answer to this risk, and Bitcoin has not adopted it because there has been nothing to adopt it against.

The honest statement is that this is a real tail risk, the warning signs are the kind that appear in academic literature years ahead, and the thing to watch is the cryptanalysis rather than any announcement.

Check it yourself

The function appears in a surprising number of places and the source makes that concrete. Merkle roots are computed in merkle.cpp, the proof-of-work check lives in pow.cpp, and tagged hashes for Taproot are in the crypto directory. Reading them together is the fastest way to see how much of the system depends on one primitive.

A smaller exercise makes the asymmetry tangible. Hash anything twice and observe how fast it is:

echo -n "hello" | sha256sum

That speed is what makes mining a search rather than a computation, and it is also why a preimage break would be catastrophic rather than inconvenient: the same operation everybody runs billions of times a second would become invertible by whoever holds the attack.

What remains uncertain

Whether a partial break is survivable in practice. The scenario most likely on historical precedent is a collision attack of gradually falling cost, which would require a case-by-case audit of every commitment scheme in Bitcoin and in everything built on it. Nobody has done that audit, so the blast radius is unmapped.

How long a migration would take. The precedent is unhelpful: no consensus change has activated since 2021, and this one would be larger and more contested than anything in the current queue.

What would count as sufficient warning. The community has no agreed threshold at which to begin migrating — no published trigger, no plan, no rehearsal. The risk is tolerable because the probability is low, and tolerable-because-unlikely is how institutions arrive unprepared.

Sources

Nearby