Random numbers
Each result is made from these four values.
- Server seed
- 64 random hex characters that we make. Until you change seeds, you see only its SHA-256 hash.
- Client seed
- A value you choose. We can't know it in advance, so we can't line results up against you.
- Nonce
- How many times you have played with this seed pair. It starts at 0 and goes up by 1 every play, so each play gets new numbers.
- Round
- Starts at 0. When a game needs more than 8 numbers in one bet, it goes up by 1 to make the next 32 bytes.
32 bytes from HMAC_SHA256
HMAC_SHA256 uses the server seed as the key and "client seed:nonce:round" as the message. One call gives 32 bytes, which is 8 numbers.
def bytes(server_seed, client_seed, nonce, count)
rounds = (count / 32.0).ceil
(0...rounds).flat_map do |round|
message = "#{client_seed}:#{nonce}:#{round}"
OpenSSL::HMAC.digest("SHA256", server_seed, message).bytes
end.first(count)
end
The server seed is used as the key as text. It is not decoded from hex.