BackgammonPearl

Dice you can check

Check a game's dice

Paste the seed from the game-over card and this page recomputes the seal and every roll, in your browser. Nothing is sent anywhere.

The game-over card shows it under "Seal opened". Tap it to copy. During a game it is still closed, on purpose.
Leave it empty and the page just computes the fingerprint for the seed above.
In seat order, as the dice sheet lists them. Offline there is only yours.
Rolls are numbered from 1 across the whole match. Opening roll-offs count too, and a Classic match keeps counting from game to game.
The rolls as the dice sheet lists them, with or without their numbers. Paste them and every roll is compared, not just shown.

How a roll is computed

The same code runs in the app and on the server; this page is a copy of it. Every roll of a match comes from one HMAC:

mac  = HMAC-SHA256(key = server seed bytes,
                   message = clientSeed1 ":" clientSeed2 ":" rollNumber)
byte = the first byte of mac that is below 252
v    = byte mod 36
dice = (floor(v / 6) + 1,  v mod 6 + 1)

252 is 7 × 36, so each of the 36 ordered rolls is equally likely. Bytes 252 to 255 are skipped because keeping them would favour the first four rolls a little. If none of the 32 bytes is below 252 (a chance of about 2-192, so it has never happened and will not), a + is appended to the client-seed part and the MAC is computed again: clientSeed1:clientSeed2+:rollNumber, then ++, and so on.

The seal shown before the first roll is SHA-256(server seed bytes) as hex. A server seed has 16 to 64 bytes; the game uses 32. A client seed is 1 to 128 characters of letters, digits, _ and -; the app sends 32 hex characters.

Why this works

The fingerprint is on the table before the first roll, so the server cannot change its seed after seeing how the game goes without the fingerprint changing too. Your phone's number is drawn after the seed is sealed, so the server cannot pick a seed that suits a number it has not seen. Every roll depends on both, and you hold everything needed to recompute them.

If the page shows a roll that differs from what you saw on the board, or a seal that does not match, keep the seeds and write to [email protected]. We want to know.

Linking to this page

The game-over card opens this page with the game filled in. The link carries the same fields: /check/?seed=…&seal=…&client=a,b&n=52&rolls=6344…, where rolls lists the dice two digits per roll in roll order.