Provably Fair Algorithm Explained Step by Step on a Real Round

How a provably fair system turns seeds into results: the provably fair algorithm explained step by step, from SHA-256 to HMAC-SHA256 to one real roll.

Updated October 23, 2026

Contents
  1. What goes into the provably fair algorithm before the first bet?
  2. How the algorithm runs, explained step by step
  3. Can you run the algorithm step by step yourself?
  4. What would cheating look like at each step?
  5. Why does the provably fair algorithm use HMAC?
  6. What changes from one bet to the next?
  7. Where do real platforms differ from this scheme?

Try the scheme

Example round · Dice

Published hash

The SHA-256 fingerprint the game showed before you played. Without it the tool can calculate the result but cannot check the commitment.

Result the game showed

Optional. Paste the result from the round history to compare it with the calculated one.

Calculated result · Dice roll

42.17

  • Commitment matches the published hash
  • No game result entered to compare

How this result was derived
  1. 1

    Commitment, before the round

    SHA-256(server seed) = f51376a5a542e19876a861e25e058cc522a304cd3edbd012bad096d8cc543de0
  2. 2

    HMAC-SHA256 of player-17:1:0

    6bf446d5eea533d95c787f63c2ac5b6943a7f7dcf4dc68f9edf3569f0c50953f
  3. 3

    Bytes to a number in [0, 1)

    0.4216961164
  4. 4

    floor(x × 10,001) ÷ 100, a roll from 0.00 to 100.00

    42.17

This tool reproduces one documented reference scheme. Platforms that build the message, read the bytes or map the number differently will give other results with the same seeds. See the scheme.

2256
Possible 64-character server seeds
32 bytes
Output of one HMAC-SHA256 call
232
Possible values of x from four bytes
42.17
Dice roll of the example round
Illustration: three seeds dropping into a small machine with gears that rolls out a single mint ball

Feed the text player-17:1:0 into HMAC-SHA256, keyed with our example server seed, and the first byte that comes out is 6b, which is 107. Three more bytes and four short lines of arithmetic later, that byte has become a dice roll of 42.17. That chain is the whole provably fair system: a published hash of a secret seed, a keyed hash of the seeds and a counter, a conversion from bytes to a number, and a rule that turns the number into a game result. The provably fair algorithm is the exact recipe for each link.

This page, part of our section on how provably fair works, walks that chain step by step. Each step is explained with real values from the same round, so you can follow it on paper or in a terminal. Everything here is the reference scheme this site uses, the same one our calculator runs. Real platforms build on the same parts but differ in the details, and the last section lists where.

What goes into the provably fair algorithm before the first bet?

Three inputs, and one public promise. The server seed is a random value the game picks and keeps secret for now. In our example it is 64 hexadecimal characters:

server seed = a411321fbc84884ec3c90c0c4961d2667a34fb71de166237b161007cf2f7fd78
client seed = player-17
nonce       = 1

Sixty-four hex characters encode 256 bits, so there are 2256 possible seeds. That size is not decoration. The published hash only keeps the seed hidden if nobody can guess it by trying candidates, and 2256 candidates is far beyond any amount of computing that exists.

The client seed is yours. It can be any text, and the game should let you change it. The nonce counts your bets under the current seed pair and goes up by one each time. The roles of the server seed and client seed, and what happens when you change either one, have their own page on seeds and nonces. For this walkthrough they are just fixed values.

The promise is the commitment, which comes first.

How the algorithm runs, explained step by step

Step 1: hash the server seed and publish it

Before any bet, the game computes the SHA-256 hash of the server seed and shows it to you.

commitment = SHA-256("a411321f…fd78")
           = f51376a5a542e19876a861e25e058cc522a304cd3edbd012bad096d8cc543de0

SHA-256 is defined in NIST's FIPS 180-4 and always produces 256 bits, written as 64 hex characters. The input here is the seed's text, 64 characters, exactly as it will be revealed. From this moment the game is bound: a different seed would give a different hash, and finding another seed with this exact hash is not feasible. The protocol idea behind this, committing first and opening later, is covered on the page about commit and reveal.

Step 2: build the message

The game joins your client seed, the nonce and a cursor with colons:

message = client seed + ":" + nonce + ":" + 0
        = player-17:1:0

That is 13 characters, and every one counts. A space, a capital letter or a nonce off by one produces a different message and, from there, an unrelated result. The trailing 0 is the cursor. Each HMAC output gives eight numbers, four bytes each, and the four games on this page use only the first, so for them the cursor is always 0. Games that need more numbers in one round, such as a plinko path or a shuffled deck, read the other seven and then run the HMAC again with cursor 1, 2 and so on.

Step 3: run HMAC SHA256 over the message

Now the server seed comes back as a key. The game computes HMAC with SHA-256, keyed with the server seed, over the message:

HMAC-SHA256(key = "a411321f…fd78", message = "player-17:1:0")
  = 6bf446d5eea533d95c787f63c2ac5b6943a7f7dcf4dc68f9edf3569f0c50953f

The output is 32 bytes. Like the commitment, it looks random, and changing any input changes all of it. This is the only step where the secret key, your seed and the bet counter meet, so it is the heart of the provably fair system: the server cannot run it ahead of time for your bet without knowing your client seed, and you cannot run it ahead of time without knowing the server seed.

Step 4: turn four bytes into a number

The scheme reads the first four bytes of the HMAC output and turns them into a fraction between 0 and 1. Each byte is worth 256 times less than the one before it, like digits in base 256.

Byte Hex Decimal Contribution to x
b0 6b 107 107 ÷ 256 = 0.41796875
b1 f4 244 244 ÷ 2562 = 0.00372314453125
b2 46 70 70 ÷ 2563 ≈ 0.0000041723
b3 d5 213 213 ÷ 2564 ≈ 0.0000000496
x = b0/256 + b1/256² + b2/256³ + b3/256⁴
  = 0.4216961164…

The first byte does almost all of the work, and the last one adjusts x by less than one part in ten million. Together they give 232, or 4,294,967,296, evenly spaced possible values from 0 up to, but never reaching, 1. This conversion is where provably fair random number generation becomes a usable number: everything before it produces bytes, and everything after it consumes a fraction.

Step 5: apply the game's rule

The last step is the only one that depends on the game, and it is where the provably fair algorithm stops being shared machinery. Each rule takes x and maps it onto the game's possible outcomes.

Dice:   floor(0.4216961164 × 10,001) = floor(4217.38…) = 4217 → 4217 ÷ 100 = 42.17
Crash:  1 − x = 0.5783038836 → 99 ÷ 0.5783038836 = 171.19… → floor = 171 → 1.71×
Hi-Lo:  floor(0.4216961164 × 52) = floor(21.93…) = 21 → rank 21 mod 13 = 8 → 9, suit floor(21 ÷ 13) = 1 → hearts
Limbo:  floor(x × 16,777,216) = 7,074,886 → 16,777,216 ÷ 7,074,887 × 0.99 = 2.3476… → 2.34×

Dice has 10,001 possible rolls, from 0.00 to 100.00. Hi-Lo uses a deck ordered ace to king within each suit, with the suits in the order spades, hearts, diamonds, clubs, so card 21 is the ninth card of the second suit. Crash and limbo both carry a 1% house edge in their formulas (the 99 and the 0.99), and both are floored at 1.00×.

Can you run the algorithm step by step yourself?

Yes, and doing it once by hand is the best way to trust the calculator afterward. You need nothing beyond a terminal on Linux or macOS. On a Mac, use shasum -a 256 where the first line below says sha256sum.

printf '%s' a411321fbc84884ec3c90c0c4961d2667a34fb71de166237b161007cf2f7fd78 | sha256sum
→ f51376a5a542e19876a861e25e058cc522a304cd3edbd012bad096d8cc543de0

printf '%s' 'player-17:1:0' | openssl dgst -sha256 -hmac a411321fbc84884ec3c90c0c4961d2667a34fb71de166237b161007cf2f7fd78
→ 6bf446d5eea533d95c787f63c2ac5b6943a7f7dcf4dc68f9edf3569f0c50953f

The printf '%s' matters. The more familiar echo adds a line break to the end of its text, and a hash of the seed plus a line break is a different hash. This is the single most common reason a hand check fails, and it has nothing to do with the game.

From the HMAC output, take the first eight hex characters, 6bf446d5, split them into four pairs, and convert each pair to decimal. The rest is the arithmetic in steps 4 and 5, which any spreadsheet can do. If you prefer to script it, every mainstream language ships SHA-256 and HMAC in its standard library, and browsers expose both through the Web Crypto API.

Running the provably fair algorithm by hand like this also shows you something a calculator hides: there is no step where the game could quietly add an input. Every value in the chain is either public, yours, or revealed later.

What would cheating look like at each step?

It helps to read the scheme from the other side and ask where a dishonest game would try to interfere, because each step exists to close one door.

A game could try to change the server seed after seeing your bet. Step 1 stops that, because any other seed gives a different hash from the one you were shown. A game could try to pick, before publishing, a server seed that happens to produce bad results. That only works if it knows the other inputs, and your client seed, set after the commitment, takes that knowledge away. A game could try to report a result that the inputs did not produce. Steps 2 to 5 stop that, since you can recompute the result exactly.

What the scheme cannot stop is a game that never reveals the old seed, or one that hides how it maps numbers to results. Both show up as a check you cannot complete, which is itself the warning sign. Every step in the chain is explained by the attack it blocks, and a missing step means a missing protection. This is also where provably fair random number generation differs from an ordinary random number generator: an ordinary one may be perfectly honest, but it gives you nothing to recompute.

Why does the provably fair algorithm use HMAC?

A reasonable question is why the scheme does not simply hash the server seed, the client seed and the nonce together with SHA-256. The short answer is that HMAC was designed for exactly this job, mixing a secret key with a message, and gluing strings together by hand was not.

HMAC was published in 1997 as RFC 2104 by Hugo Krawczyk, Mihir Bellare and Ran Canetti, and NIST standardized it as FIPS 198-1 in 2008. It runs the hash function twice, once over the key mixed with one fixed padding byte and the message, and once over the key mixed with a second padding byte and the first result. That nesting closes off attacks that plain hashing of a key and a message can allow, and it is why many platforms describe their fairness step as HMAC SHA256 in their documentation. In our scheme, HMAC SHA256 also has a practical advantage: browsers, operating systems and programming languages all include it, so nobody needs special software to check a round.

SHA-256 processes data in blocks of 64 bytes, and HMAC first adjusts any key to that size: a longer key is hashed down, a shorter one is padded with zeros. Our server seed, used as 64 characters of text, is exactly one block long, so it goes in unchanged. A platform that first decodes the same hex into 32 raw bytes would get a different HMAC from the same seed. Neither choice is wrong. Your check just has to match the platform's. The page on SHA-256 and HMAC covers both functions in more depth.

What changes from one bet to the next?

Only the nonce. The commitment stays the same for every round under one seed pair, and so do the server seed and client seed. Here are the first three bets with player-17:

Nonce First four bytes x Dice
1 6b f4 46 d5 0.4216961164 42.17
2 f8 b3 0b d7 0.9714820290 97.15
3 8f 0f a2 5f 0.5588323099 55.88

The same three values of x give crash points of 1.71×, 34.71× and 2.24×, and Hi-Lo cards of the 9 of hearts, the queen of clubs and the 4 of diamonds. Nothing in the first row hints at the second. That independence is what you want from a fair sequence, and it is also why a run of low rolls says nothing about the next one.

You may notice that nonce 2 produced a high dice roll and a crash point of 34.71×, while limbo for the same round gives only 1.01×. That is not a contradiction. Limbo divides by x, so a large x gives a small multiplier, while crash divides by 1 − x. The same number can be lucky in one game and unlucky in another.

Where do real platforms differ from this scheme?

Platforms that offer provably fair games generally use a hashed server seed, a client seed and a keyed hash, but few match this page byte for byte. These are the places to look when your own check does not line up.

The message format varies. Some platforms use colons, some use dashes, some leave out the trailing counter, and some start the nonce at 0 instead of 1. Some systems use SHA-512 instead of SHA-256, which gives 64 bytes of output instead of 32.

The byte reading varies too. Some schemes read four bytes as we do, others read more for finer resolution, and games that need many numbers per round, such as a shuffled deck or a mines grid, pull several groups of bytes or raise the counter to get more output. The mapping rules for each game differ the most of all, which is why the same seeds on two platforms rarely produce the same roll.

Multiplayer crash games often use a different structure entirely: a long chain of hashes played in reverse, sometimes mixed with a public value such as a future block hash, instead of a per-player seed pair. The commitment idea is the same, but the inputs are not.

None of this makes the general approach weaker. It means the right question for any game is not whether it uses a provably fair system but whether it publishes the exact recipe, so that a check like the one above can be repeated step by step. Once you have that recipe, the next step is to try a round of your own in the calculator and compare its result with the game's history, starting with the commitment hash and nothing else.

FAQ

01

Is there one standard provably fair algorithm?

No. Most platforms share the same building blocks, a hashed server seed, a client seed, a nonce and a keyed hash, but they differ in message format, byte use and game mapping. Always check a platform's own documentation before verifying its rounds.
02

Why does the algorithm use HMAC instead of hashing the seeds together?

HMAC is a standard construction for keyed hashing, defined in RFC 2104 and FIPS 198-1. It gives the server seed a clear role as a secret key and avoids weaknesses that ad hoc ways of gluing a key and a message together can have.
03

What does the 0 at the end of the message mean?

It is the cursor. One HMAC output gives eight numbers of four bytes each, and single-number games such as dice, crash, hi-lo and limbo only need the first, so they stay at cursor 0. Games that need more numbers in one round, such as plinko, mines or a blackjack shuffle, read the rest of that output and then move on to cursor 1, 2 and so on.
04

Why are only the first four bytes used?

Four bytes give 232, about 4.29 billion, possible values, which is plenty of resolution for a dice roll or a card. The other 28 bytes are not needed for single-number games. Multi-number games read them as numbers two to eight, four bytes each.
05

Can two different rounds produce the same result?

Yes, and that is expected. Two nonces can easily map to the same dice roll or card, just as two physical rolls can. What cannot repeat by design is the HMAC message, because the nonce changes with every bet.
06

Is the server seed used as text or as raw bytes?

In the reference scheme the HMAC key is the seed's 64 hex characters encoded as text, so the key is 64 bytes long. Some platforms decode the hex into 32 raw bytes first, which gives a different HMAC, so this detail matters when you verify.
07

Why does crash use 99 in its formula?

The 99 builds a 1% house edge into the crash point. Without it the formula would use 100, and the chance of reaching any multiplier m would be about 1 ÷ m instead of 0.99 ÷ m. The odds are worked through in crash gambling explained.
08

Could someone predict results by studying many past rounds?

Not from the outputs alone. HMAC-SHA256 output does not reveal the key, so past results give no usable clue about the server seed. Prediction would need the active seed itself, which stays hidden until you rotate.
09

Does the algorithm prove the game pays fairly?

It proves the result came from the committed inputs through the documented math. The payout table and the house edge are separate design choices, covered on the page about what provably fair does not prove.
10

Can I run the algorithm without the site's calculator?

Yes. Any language with SHA-256 and HMAC works, and on Linux or macOS the sha256sum (or shasum -a 256) and openssl commands cover the first two steps. The calculator is simply the fastest route.
11

What happens if one input is wrong by a single character?

The HMAC output changes completely and the result will not match. Changing player-17 to Player-17 in the example round turns a 42.17 roll into 17.52, so check capitals, spaces and the nonce before suspecting anything else.