Stack Data · com.stack.hud.fair.ProvablyFairRng

fairness

Fill the verifier, or click a row in recent rounds to load a demo round. This site uses HMAC-SHA256 with the same rules as the Paper plugin (not third-party seedrandom). Your commitment is the SHA-256 of the server seed before the round.

← Home

verify

stackmc/verify /

Each draw uses the server seed and a path (see plugin). Hash the seed and compare to the value shown before the round in-game.

For roulette, use the spin number only.

Result appears here after you run verify.

code

Server (Java) — your browser does the same HMAC in the verifier (Web Crypto).

// ProvablyFairRng.java (Stack Data)
public int nextInt(int bound, String... pathSegments) {
  long u = unsignedLongFromHmac(hmac(pathSegments));
  return (int) Math.floorMod(u, (long) bound);
}
// HMAC: key = UTF-8(server seed), if key.length > 64 then SHA-256(key)
// message = UTF-8( join( ":" , pathSegments ) )
// u = first 8 bytes of HMAC, big-endian unsigned
// index = u % (unsigned) bound
//
// Roulette example:
winnerIndex = fair.nextInt(
  cells, "roulette", "spin", Long.toString(spin), "winner");

recent rounds

Same game as in the selector above — click a row to load it into the verifier.

date (UTC) game outcome round path
How it works (manual & per-session games)

Mines, Dragon Tower, and Chicken use session ids and (for tower) a client seed. The server still derives Random from ProvablyFairRng#randomFor — the same HMAC rules as the rest of the minigames.

// Mines — Fisher–Yates on indices, then first k = mines
Collections.shuffle(idx, fair.randomFor("mines", gameId, "shuffle"));