Explainer · · 6 min read
What it costs to find a SHA-256 prefix
64 times as many guesses on average for each extra Base64 character. That drops to 32 times for a letter if you ignore case.
1. Guess, hash, compare, repeat
The miner runs SHA-256 on a phrase and counter, such as gensys:0. It checks the Base64 digest for your prefix and verifies each match with a reference library. The counter is called the nonce.
gensy with ignore-case was found at nonce 60,237,861 (v2/README.md).2. Guesses per character
A Base64 character holds 6 bits. Each guess has a 1 in 64 chance of matching an exact character.
Time is expected guesses divided by hashes per second. Extra threads raise that speed without changing the number of guesses needed.
Formula, thread counts and prefix limits
For L letters and D other characters, expect 32L × 64D guesses ignoring case, or 64L+D in exact case.
On one shared machine, speed rose by less than the thread count. With 6 threads the miner averaged 97 million hashes a second, and with 11 it averaged 109 million. Each setting ran 3 times.
The miner takes 1 to 10 Base64 characters or 1 to 16 hex characters.
3. Calculator
About 10 seconds on average for six letters ignoring case at the default speed. Ten exact characters take centuries.
Pick a length, a mode and a speed. The answers update as you type.
The controls need JavaScript. The answers below are the default: 6 letters, ignore-case, 104.6 million hashes per second.
Ignore-case: all 6 characters are letters.
Default speed and assumptions
The 104.6 default is the median of a 3-run pilot with the default backend and 6 pinned threads on a shared i7-8700. The unpinned median of 87.6 gives about 12 seconds for six letters ignoring case. The tests did not isolate pinning.
The fast path needs a message that fits one SHA-256 block. Speed depends on the CPU.
The model assumes a steady speed and independent random hashes, so trying counters in sequence does not improve the odds. For N expected guesses, the chance of a hit by then is 1 − (1 − 1/N)N, about 63.2% for large N. Runs can finish much sooner or later than the average.
Nonce limit
Nonces run from 0 to just under 264. Starting above zero with --start-nonce leaves fewer guesses.
A 10-character exact Base64 prefix needs about 260 guesses, 16 times fewer than the full nonce space. The chance of running out is about 1 in 9 million.
A 16-character hex prefix needs 264 guesses on average. The chance of running out is about 37%.
4. Memory use
The miner discards misses and keeps only finished ranges, so memory does not grow with the number of guesses.
Batches, checkpoints and resume
Each thread claims the lowest unfinished chunk and hashes 128 nonces at a time. The journal updates every half second. Finished ranges merge when they touch, so a run without gaps keeps one range.
Rerun with the same flags to resume from the checkpoint and journal. The miner repeats any unfinished chunk.
Sources and credits
- The repository and its v2 notes.
- We made our SHA-256 miner about 42 times faster: the step-by-step explainer, with the measured tests.
Code and benchmark references
- Search loop — message, encoding, hit verification.
- Search cost — prefix validation, limits, cost rule, nonce limit.
- Speed — earlier runs, pinned pilot, unpinned runs, single-block fast path.
- Memory — chunk size, batch size, claiming, checkpointing, range merging, journal and resume, resume.
The analysis, diagrams and calculator were drafted by ChatGPT (OpenAI GPT-6), then reviewed and edited by Claude.