Provably fair
To create a roll number, Dicexbet uses a multi-step process to create a roll number 0-99.99. Both client and server seeds and a nonce are combined with HMAC_SHA512 which will generate a hex string. The nonce is the # of bets you made with the current seed pair. First five characters are taken from the hex string to create a roll number that is 0-1,048,575. If the roll number is over 999,999, the process is repeated with the next five characters skipping the previous set. This is done until a number less than 1,000,000 is achieved. In the astronomically unlikely event that all possible 5 character combinations are greater, 99.99 is used as the roll number. The resulting number 0-999,999 is applied a modulus of 10^4, to obtain a roll number 0-9999, and divided by 10^2 to result a 0-99.99 number.
const roll = ({ serverSeed, clientSeed, nonce }) => {
const nonceClientSeed = `${clientSeed}-${nonce}`;
const hex = createHmac('sha512', serverSeed)
.update(nonceClientSeed)
.digest('hex');
let index = 0;
let lucky = parseInt(hex.substring(index * 5, index * 5 + 5), 16);
while (lucky >= 1e6) {
index += 1;
lucky = parseInt(hex.substring(index * 5, index * 5 + 5), 16);
// we have reached the end of the hash and they all must have been ffffff
if (index * 5 + 5 > 129) {
lucky = 9999;
break;
}
}
return [lucky % 1e4] * 1e-2;
}
Enter a hashed server seed of game to check for fair.