Docs / Knowledge Base / Collision resistance and proof-of-work search
Knowledge Base
Contents
Collision resistance and proof-of-work search
Part: General · Under: Mathematics · Chapter: Collision resistance and proof-of-work search · Edition: 2026-11-28
Keywords: SHA-256, collision resistance, preimage, nonce, difficulty, proof of work
Glossary:Hash (cryptographic)— see GLOSSARY
Overview
- Bitcoin’s proof of work accepts an 80-byte block header when SHA-256, applied twice, yields a digest that is at most the current target as a 256-bit integer. The function in that test is the full 64-step SHA-256.
- The nonce is the integers 0 through 4,294,967,295. A timestamp must be later than the median of the previous 11 blocks, and a node rejects a timestamp more than two hours ahead of its clock. Further headers are produced by an extra nonce in the coinbase transaction, which changes the Merkle root.
- In the ideal-hash model the expected length of that search is about the current difficulty multiplied by . One full pass over an 80-byte header is three compressions of 64 steps.
- Goldzweig’s preprint on the IACR Cryptology ePrint Archive (2026/2913, posted 21 November 2026) exhibits a collision for SHA-256 stopped after 38 steps, from the standard initial value. For the full 256-bit function the generic collision cost is about evaluations, and the generic preimage cost is .
Public descriptions sometimes treat a mining chip as if it had solved SHA-256, and sometimes call the value being varied a salt. The objects are different, and a citation can keep them apart. This note records the function Bitcoin evaluates, the header fields a search may change, and the ideal-hash cost used to talk about difficulty. It is written for institutional and document use. It is not a miner configuration, not a collision-search procedure, and not a statement about the price of any asset.
Applications at Keyne Digital Assets
Situation Monitor reads public language in which a hash rate, a cryptographic property, and a password salt are regularly fused. We keep this note so that a throughput figure, a collision bound, and a header field remain separate nouns. We do not ship a mining setup, and we do not reproduce a collision search.
1. What the hash is asked to do
SHA-256, specified in FIPS 180-4, maps a message to a 256-bit digest. The compression loop runs 64 steps. Attack papers often call the same loop a round. Collision resistance, preimage resistance, and second-preimage resistance are design goals. They are not theorems that the standard proves.
| Property | What it asks | Generic cost on a 256-bit digest |
|---|---|---|
| Collision resistance | Find two distinct inputs with the same digest | About evaluations, the birthday bound |
| Preimage resistance | Find an input for one prescribed digest | evaluations |
| Second-preimage resistance | Find a second input for one given input’s digest | evaluations |
Nakamoto’s 2008 paper defines the proof-of-work task as a scan for a hash with many leading zero bits, and names SHA-256 as the example. The implemented test is sharper than that picture. Nodes hash the 80-byte header with SHA-256, hash that 32-byte digest again, and read the result as a little-endian integer. The header is valid when that integer is less than or equal to the target. The familiar block id prints the digest in the opposite byte order, which is why a valid id is written with leading zeros. Leading zeros are the visible sign of a low target. The acceptance rule is the integer comparison.
That task is a search for a digest inside a large initial segment of the output space. A collision is a pair of inputs that share one digest. The two counts are different. A colliding pair does not, by itself, put a header under the target.
The avalanche property is why the search is modelled as memoryless. A small change in the header is supposed to scramble the digest, so one trial does not point toward the next. The model below uses that design intention. It is not a proof that the outputs are uniform.
2. Nonce and salt
The value miners increment is the nonce. It is not a salt in the password-hash sense.
Value that varies
- Password storage
- A salt stored beside the hash, usually random and not secret
- Header search
- The nonce, then the time, some version bits, or the extra nonce
Job of that value
- Password storage
- Make equal passwords hash differently, so one precomputed table does not open every account
- Header search
- Offer another header whose digest might land at or below the target
Is the function run backwards?
- Password storage
- No. The stored hash is checked forward
- Header search
- No. The header digest is checked forward
How a hit is obtained
- Password storage
- By trying candidate passwords
- Header search
- By trying candidate headers
The nonce is public once a block is published. It is a 32-bit counter inside the header. A salt’s job is to separate stored password hashes. The nonce’s job is to label the next candidate in a search that never inverts the compression function.
3. Fields the search may change
The header is 80 bytes: a 4-byte version, the 32-byte hash of the parent header, a 32-byte Merkle root, a 4-byte time, a 4-byte compact target (nBits), and a 4-byte nonce.
Nonce
- Width
- 4 bytes; the integers 0 through 4,294,967,295
- Role in the search
- The counter. After values the field is exhausted
Time
- Width
- 4 bytes, a Unix time
- Role in the search
- Must be strictly later than the median time of the previous 11 blocks. Nodes also reject a header more than two hours ahead of their clock. The legal window is measured in hours, so it is much smaller than
Version
- Width
- 4 bytes
- Role in the search
- Some bits signal soft forks. BIP 320, still a draft, proposes bits 13 through 28 (the mask
0x1fffe000, sixteen bits) for general use. Pools negotiate a version-rolling mask inside that kind of range
Extra nonce
- Width
- Chosen by the miner or the pool; often on the order of 4 to 8 bytes
- Role in the search
- Not a header field. It sits in the coinbase transaction. Changing it changes the coinbase id and therefore the Merkle root
Merkle root
- Width
- 32 bytes in the header
- Role in the search
- Not a free 32-byte counter. It is the root of the transaction tree. It moves when the extra nonce or the transaction set moves
Parent hash
- Width
- 32 bytes
- Role in the search
- Fixed by the block being extended
Compact target
- Width
- 4 bytes
- Role in the search
- Set by the difficulty rules. Searching for an easier encoding does not produce a valid header
A 4-byte extra nonce supplies new templates, and each template still has its own nonce sweep, so the product is trials before that extra nonce rolls over. An 8-byte extra nonce brings the product to . Those widths are software choices. Consensus does not fix them.
The Merkle tree is a binary tree of double SHA-256 transaction ids. Bitcoin duplicates the last hash on a level that has an odd count. With the sibling hashes cached, a new coinbase updates one hash per level, a cost proportional to , with n the number of transactions. Rebuilding the tree from the leaves is proportional to n.
4. The cost of one trial and of the search
SHA-256 compresses 512-bit blocks. An 80-byte header, with the standard padding and the 64-bit length, fills two blocks, so the inner hash is two compressions. The outer hash takes the 32-byte inner digest and fills one block. A full evaluation is therefore three compressions of 64 steps.
The first of those blocks is the first 64 bytes of the header: the version, the parent hash, and the first 28 bytes of the Merkle root. The remaining 16 bytes of the header, which hold the rest of the root, the time, the compact target, and the nonce, fall in the second block. A sweep that changes only the nonce or the time can reuse the first compression. A change to the version, or to the Merkle root, recomputes it.
Let T be the target. Under the model that each digest is an independent uniform 256-bit string, a trial succeeds with probability . The number of trials until the first success then has expectation
Here N is that waiting time. Bitcoin’s difficulty d is , where is the difficulty-1 target. The compact encoding of is 0x1d00ffff, which expands to . Hence
The factor 65536/65535 is about 1.000015. Dropping it, and dropping the (+1) in the denominator, leaves the working figure used in documents: about trials. Difficulty is a ratio of targets. The expected trial count is that ratio scaled by about . At difficulty 1 the target already demands on the order of hashes, because sits near .
Landau notation can hide that constant. A single evaluation does not grow with the transaction count, so it is in n. A nonce sweep is at most evaluations of a fixed header tail, which is also O(1) in n, and the constant is the whole cost of that sweep. The Merkle update is with cached siblings and when the tree is rebuilt. The expected search length, as (T) shrinks, is . Writing that length as is the same statement only after has been absorbed into the constant. A cost note should leave on the page.
One double SHA-256 of an 80-byte header
- Bound
- Three 64-step compressions
- What the bound counts
- Fixed input length. Nonce-only trials can reuse the first compression
Nonce sweep of one template
- Bound
- At most trials
- What the bound counts
- Constant in n. The constant is large enough that present hardware finishes it in a fraction of a second
Coinbase change, siblings cached
- Bound
- What the bound counts
- One new hash at each level of the tree
Full Merkle rebuild
- Bound
- What the bound counts
- Every transaction hashed again
Expected trials until the target is met
- Bound
- , about
- What the bound counts
- Ideal uniform model. is Bitcoin’s difficulty
Generic collision, full 64-step SHA-256
- Bound
- About evaluations
- What the bound counts
- Birthday bound. A collision is not a header under the target
Generic preimage, full 64-step SHA-256
- Bound
- evaluations
- What the bound counts
- One prescribed digest. The mining target is a wide initial segment, not one digest
No published attack supplies a practical collision or a practical preimage for the full 64-step function. The generic figures are the costs of unstructured search against an ideal 256-bit output. They are upper bounds on the work a document should treat as the brute-force baseline, not a proof that SHA-256 meets them.
5. Collisions on a reduced-step function
On 21 November 2026 the IACR archive posted Omer Goldzweig’s preprint “A Collision for 38-Step SHA-256” (ePrint 2026/2913, received 16 November). Archive posting is not journal peer review. The paper gives a collision for the compression loop stopped after 38 of the 64 steps, starting from the initial value fixed by the standard. The author describes it as the first such collision from that initial value.
The abstract states the accounting. The expected time is calls of the 38-step compression function. A further table accesses are not included in that count. The tables occupy 7.4 GB. Finding the fixed state words took 52,300 vCPU-hours. A search of 53 GPU-hours then produced the collision, at about a tenth of the expected search. Those figures belong to the 38-step function. Adding further steps takes the pair off the colliding digest. Bitcoin calls the 64-step function, and it calls that function twice.
The same preprint records that semi-free-start collisions, in which the attacker chooses the chaining value, were already known at 38 and 39 steps. Mendel, Nad, and Schläffer (EUROCRYPT 2013) include a semi-free-start collision at 38 steps in that line of work. Choosing the chaining value is a weaker problem than colliding from the standard initial value, and both problems are weaker than colliding the 64-step function.
6. Hardware speed and the retarget
A hashing ASIC is a circuit hardwired to evaluate this double SHA-256 pipeline. The gain is trials per second and energy per trial. The predicate that accepts a header remains the comparison with the target. The hardware account of the pipeline, and of why a photonic substitute is a poor fit for the same rounds, is the chapter on ASICs for hashing, photonics, and lithography.
Definition (break, in this note). A break of SHA-256, as the word is used in cryptanalysis, is a practical collision, preimage, or second preimage for the full 64-step function. A higher trial rate is a change in throughput. It leaves the three properties above, and the acceptance test, where they stood.
Every 2,016 blocks the network recomputes the target so that the average interval stays near ten minutes. The aimed timespan is seconds, which is 1,209,600 seconds, or 14 days. The timespan actually used is clamped to between one quarter and four times that aim, and the new target is the old target scaled by the ratio of the clamped timespan to the aim. The target is also kept no easier than . When blocks arrive faster than the aim, the next retarget lowers the target, and the expected trial count rises by about the same factor. The chips change the energy spent and the share of blocks found. They do not enlarge the set of digests the current target accepts.
See also
References
- Nakamoto, Bitcoin: A Peer-to-Peer Electronic Cash System (2008)
- Bitcoin developer reference: block chain
- NIST FIPS 180-4, Secure Hash Standard
- Goldzweig, A Collision for 38-Step SHA-256 (ePrint 2026/2913)
- Mendel, Nad, and Schläffer, Improving Local Collisions (EUROCRYPT 2013)
- BIP 320, draft: nVersion bits for general purpose use
On this page