✖

Is Bitcoin secure? What its cryptography rests on

Bitcoins are stolen all the time: from exchanges that people trusted with their coins, through fake websites that trick you into giving up a password, to wallets with a badly generated key. And yet in the seventeen years since the first block (3 January 2009) nobody has broken the maths of Bitcoin. Nobody has forged a signature without the key, and no old payment has been rewritten after the fact. Anyone who wants to know whether Bitcoin is secure has to tell two completely different things apart: breaking Bitcoin and robbing Bitcoin users. The first would mean finding a hole in the maths and endangering everybody at once. The second is ordinary theft, the kind that also happens with cards and passwords.

Why bother with this? Because headlines such as “quantum computer will break Bitcoin” or “researchers find an attack on SHA-256” keep turning up in the news. To judge them, you need to know what Bitcoin stands on and how to measure how much work an attack would take. We will work out both. The short answer: the maths of Bitcoin holds today with an enormous safety margin, and a quantum computer that could threaten it does not exist as of December 2026.

First, what Bitcoin actually is, in a nutshell. It is a shared ledger kept by thousands of computers around the world, and payments such as “Adam sends Bára 1 BTC” are written into it. Payments are collected into blocks, bundles written roughly every ten minutes, and the blocks are lined up one after another in a chain. You will find the details in the first part of the series on how Bitcoin works.

What Bitcoin’s security rests on

Bitcoin rests on three mathematical pillars. If any one of them collapsed, Bitcoin would be in trouble.

Three pillars under a roof bearing the Bitcoin symbol. A red pillar with a padlock, labelled secp256k1; a blue pillar with a fingerprint, labelled SHA-256 and RIPEMD-160; a green pillar with a chip and a chain of three blocks, labelled PoW Three pillars under a roof bearing the Bitcoin symbol. A red pillar with a padlock, labelled secp256k1; a blue pillar with a fingerprint, labelled SHA-256 and RIPEMD-160; a green pillar with a chip and a chain of three blocks, labelled PoW

Signatures on an elliptic curve: who may spend. Bitcoins are tied not to a name but to a key. The private key is a giant secret random number k with about 77 digits. From it, on an elliptic curve called secp256k1, the public key is worked out, the point k · G, and from the public key the address, which you can give to anybody as an account number. Whoever wants to send coins on from an address has to sign the payment electronically with the private key. Anyone who knows the public key can check the signature, but only the holder of the private key can produce it.

Hash functions: addresses, blocks and history. A hash function squeezes any data into a short hash from which the data cannot be recovered, and the slightest change to the data changes the hash beyond recognition. Bitcoin uses two of them: SHA-256, whose hash has 256 bits, and RIPEMD-160, with 160 bits. For ordinary addresses, the address is built from the hash of the public key. And every block carries the hash of the block before it, so anyone who alters a single old payment breaks the hashes of all the following blocks and the fraud comes to light at once.

Computing power: the order of payments. A new block may be added only by whoever finds a number with which the hash of the block begins with a long run of zeros. A hash cannot be predicted, so there is no way except trying, and computers all over the world try one number after another. This is called mining, and the hash function plays the main part in it. Whoever wants to rewrite the order of payments, say to spend the same coin twice, has to outrun all the other miners put together.

What a bit of security means

How strong is each pillar? Cryptographers measure that in bits. A bit is a single zero or one. Two bits tell apart four possibilities (00, 01, 10, 11), three bits eight, and every further bit doubles the number.

A cipher or signature has b bits of security if the best known attack breaks it in roughly 2b steps. Every extra bit doubles the work, and ten extra bits multiply it by 210 = 1024, so roughly a thousand times.

What can we compare these numbers with? The best yardstick is the mining network itself, a giant army of machines that can do one thing only: compute SHA-256 hashes. According to mempool.space, the whole network computes about 0.97 · 1021 of them per second as of December 2026, nearly a one with 21 zeros. Let us rewrite that as a power of two. We use the fact that 210 = 1024 is almost exactly a thousand:

1021=(103)7≈(210)7=270

So the network computes roughly 270 hashes per second. A year has 365.25 · 24 · 3600 = 31,557,600 seconds, which is roughly 225, because 225 = 33,554,432. We multiply powers with the same base by adding the exponents:

270⋅225=295

More precisely, the result is 294.6. In a year the whole Bitcoin network computes roughly 295 hashes. And how many bits do the first two pillars have? The third is not measured in bits; it depends on the power of the honest majority of the network.

A signature on secp256k1 has 128 bits. The curve has roughly 2256 points, and the best known attack, which rests on the same trick as the birthday paradox below, needs about the square root of that number, 2256=2128 steps, as the article on elliptic curves explains.

A hash function can be attacked in two ways. Finding a preimage means taking a given hash and finding data that produce it, for instance making a key whose hash hits somebody else’s address exactly. A collision means finding any two different pieces of data with the same hash. Finding a collision is much easier, and the square root of the number of hashes is enough, thanks to the birthday paradox: in a class of 23 people, it is more likely than not that two share a birthday. The match is sought among all pairs, and pairs multiply much faster than people: 23 people make 253 pairs, 100 hashes nearly 5,000.

preimage collision
SHA-256 256 bits 128 bits
RIPEMD-160 160 bits 80 bits

A horizontal axis from 2 to the power 60 to 2 to the power 260. On the left a grey zone that contains two orange dots, 1 s and 365 d: what the Bitcoin network computes in a second and in a year. Blue bars: RIPEMD-160 at 2 to the power 80, inside the grey zone; secp256k1 and SHA-256 at 2 to the power 128; RIPEMD-160 at 2 to the power 160; and SHA-256 at 2 to the power 256. Under the bars at 80 and 128 stands h(x) = h(y), a collision, and at 160 and 256 h(x) = y, a preimage A horizontal axis from 2 to the power 60 to 2 to the power 260. On the left a grey zone that contains two orange dots, 1 s and 365 d: what the Bitcoin network computes in a second and in a year. Blue bars: RIPEMD-160 at 2 to the power 80, inside the grey zone; secp256k1 and SHA-256 at 2 to the power 128; RIPEMD-160 at 2 to the power 160; and SHA-256 at 2 to the power 256. Under the bars at 80 and 128 stands h(x) = h(y), a collision, and at 160 and 256 h(x) = y, a preimage

The axis is logarithmic: one division is twenty bits, so roughly a million times more work. The grey zone shows how far the Bitcoin network gets in a year. Notice that only one blue bar falls inside it, the collision for RIPEMD-160.

And which number applies to the coins at an address? Eva, who wants to get at Bára’s bitcoins, has two routes. An address is just a hash of the public key, but when Bára pays from the address, she has to reveal the public key so that the signature can be checked. So Eva can either work out the private key from the public key, which costs 2128 steps. Or she can draw her own keys at random until the hash of one of them comes out exactly as Bára’s address, and that is a preimage search costing 2160 steps. An attacker will take the cheaper route, so the coins are protected by 128 bits.

How many years an attack would take

Imagine that the whole Bitcoin network, instead of mining, computed the steps of an attack, and just as fast, 0.97 · 1021 steps per second. This is a simplification: mining machines can do SHA-256 only, and cannot be reprogrammed for anything else. But it makes a good yardstick. For 280 steps the network needs

2800.97⋅1021≈1246s,

so about 21 minutes. We work out the other rows the same way:

steps time for the whole network
280 21 minutes
290 15 days
2100 41 years
2110 42,000 years
2128 11 billion years

Those 11 billion years come close to the age of the universe (about 13.8 billion years).

The table teaches us two lessons. First, 80 bits is not enough today. That is why shared addresses of several people (say “any two of three may spend”) have used a 256-bit hash instead of a 160-bit one since the SegWit update in August 2017. If one of the founders found a collision, they could slip the others a different condition with the same address and then take the coins out alone. Second, 128 bits is enough with an enormous margin. Even if the power of the network grew a hundredfold, it would still be more than a hundred million years.

Theoretical or practical attack

Cryptographers call a cipher “broken” as soon as somebody devises an attack faster than brute force, that is, than trying all the possibilities. It need not be anything that could actually be carried out. Such an attack is called theoretical. A practical attack is one that can be carried out today or in the foreseeable future.

The AES cipher shows it nicely. The best known attack on AES-128 is about four times faster than brute force, so it needs 2126 steps instead of 2128. Technically that is a break, but in practice it helps nobody: for the whole Bitcoin network it would mean not 11 billion years but a little under three billion.

A theoretical attack is nonetheless not a false alarm but a warning. The hash function SHA-1 showed it, with its 160-bit hash that was supposed to offer 80 bits of resistance to collisions. In 2005 the group of Wang Xiaoyun published an attack that needed fewer than 269 steps. Nobody could compute that at the time. But the attacks improved step by step, and on 23 February 2017 Google and the CWI institute in Amsterdam announced the first real SHA-1 collision. It cost 263.1 computations, and today’s whole Bitcoin network could manage that many steps in roughly a hundredth of a second. Twelve years passed between the theoretical attack and the practical one, and whoever abandoned SHA-1 in time came to no harm.

So how is SHA-256 doing? Nobody knows an attack on the full function that beats brute force, so researchers try reduced versions. SHA-256 mixes the data in 64 rounds. At conferences in 2026 a practical collision was presented for a version cut down to 35 rounds and a theoretical one for 37. Research papers from the autumn of 2026, which have not yet been peer-reviewed, report a real collision even for 38 rounds.

A strip of 64 boxes, one for each round of SHA-256. The first 35 are green, boxes 36 and 37 orange, and the rest up to 64 grey A strip of 64 boxes, one for each round of SHA-256. The first 35 are green, boxes 36 and 37 orange, and the rest up to 64 grey

Green marks the rounds for which a peer-reviewed real collision exists, orange those that only a theoretical attack reaches. Even if the newest results were confirmed, more than 25 rounds of margin remain, which nobody has chewed through so far.

A galactic algorithm

There is one more reason why a report that “researchers have found a faster algorithm” need not mean a practical attack. The speed of an algorithm is described by how the number of steps grows with the size of the problem n. Take two algorithms. Algorithm A needs n2 steps, algorithm B needs 1030 · n steps. For a huge n, B wins, because n2 grows faster. But when does B overtake A? Only when

n2>1030⋅n,

and dividing by n gives n>1030. For all smaller problems the “worse” algorithm A is faster. Merely counting up to 1030 would take the whole Bitcoin network more than 30 years.

A graph with logarithmic axes for n from 10 to the power 0 up to 10 to the power 40. The red line n² starts low, the blue line 10³⁰ · n starts higher but climbs more slowly. They cross at an orange point at n = 10³⁰, and only to the right of it is the blue line lower A graph with logarithmic axes for n from 10 to the power 0 up to 10 to the power 40. The red line n² starts low, the blue line 10³⁰ · n starts higher but climbs more slowly. They cross at an orange point at n = 10³⁰, and only to the right of it is the blue line lower

An algorithm that is better only for problems larger than anything real is called a galactic algorithm: it would pay off only for problems the size of a galaxy. These are not mere curiosities. In 2019 David Harvey and Joris van der Hoeven presented a method for multiplying huge whole numbers that mathematicians had been waiting for since 1971. But their method kicks in only for numbers with more than 2172912 bits, that is, two raised to a power that itself has 39 digits. Such numbers would not fit into the universe even if we wrote one digit on every atom. The authors did not optimise their method in any way; they wanted to prove that it can be done. Mathematically it is a breakthrough, but for real numbers it changes nothing.

So if somebody one day announced a faster attack on elliptic curves or on SHA-256, the first question would be: how many bits of security are left, and from how large a number does the attack really help?

Where Bitcoin really breaks

Real thefts run around the maths, not through it. The most vulnerable thing is randomness. A key that is not truly random can be guessed, and a signature on an elliptic curve needs a fresh random number each time it is made, otherwise the private key can be worked out from two signatures. That is exactly how Sony lost the key to the PlayStation 3 games console. In August 2013 it emerged that the random number generator in Android had serious flaws and that Bitcoin wallets in Android phones were at risk of theft. The second weak spot is where the key lies: stolen or photographed backup words of a wallet, which the part on the seed phrase is about, or an exchange that holds keys on behalf of its customers. Maths is helpless when the key lies with somebody else.

Can Bitcoin be broken?

This part opens a block of the series about what would have to happen for one of the pillars to fall:

See also

Chapters: Bitcoin: what it is and how it works, The Bitcoin halving: why there are only 21 million bitcoins, Bitcoin mining: how proof of work works, Blockchain and the Merkle tree: how it works and why history cannot be rewritten, The Bitcoin address, private key and signature, Seed phrase: why nobody can guess the 12 words of a wallet, Ethereum: smart contracts and proof of stake, Is Bitcoin secure? What its cryptography rests on, The 51% attack: can Bitcoin be spent twice?, Quantum computers and Bitcoin: what if elliptic curves fell, Bitcoin and SHA-256: what if the hash function fell, Post-quantum Bitcoin: how Bitcoin would defend itself against quantum computers