Get ready for some exciting multiplayer action because at last, Keno is here. You spoke, we listened.
What lucky numbers and patterns will you choose to take the bankroll?
Will you go it alone or will you coordinate a strategy with your friends in chat? There are so many more possibilities with this new and exciting twist on a classic game.
Starting with a secret I've generated a chain of 10,000,000 SHA256 hashes. Each element is the hash of the lowercase, hexadecimal string representation of the previous hash. The hash of the chain's last element is
54fe30623823224ef8379e00f3d88a02ed3333937862ee0383b9cbb3d1e43763 Every game maps to a hash in the chain: The 10,000,000th element of the chain is the hash of game #1 and the first element in the chain is the hash of game #10,000,000. To verify that a hash belongs to a game #n, simply hash it n times and compare the result with the terminating hash.
To calculate a game's result from its hash:
const CryptoJS = require("crypto-js");
function seedGenerator(hash, salt) {
const hmac = CryptoJS.HmacSHA256(CryptoJS.enc.Hex.parse(hash), salt);
return hmac.toString(CryptoJS.enc.Hex);
}
function createNums(allNums, hash) {
const nums = [];
let h = CryptoJS.SHA256(hash).toString(CryptoJS.enc.Hex);
allNums.forEach((c) => {
nums.push({ num: c, hash: h });
h = h.substring(1) + h.charAt(0);
});
nums.sort(function (o1, o2) {
if (o1.hash < o2.hash) {
return -1;
} else if (o1.hash === o2.hash) {
return 0;
} else {
return 1;
}
});
return nums;
}
function keno(hash) {
const salt = 'salt waiting to be generated';
const allNums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40]
const seed = seedGenerator(hash, salt);
let finalNums = createNums(allNums, seed);
finalNums = createNums(finalNums, seed);
return finalNums.slice(0, 10).map(m => m.num)
}
let hash = 'game hash';
console.log('result =>', keno( hash ).map(item => item.num).join(','));
Before being used to calculate the corresponding result, each game hash is salted with the lowercase, hexadecimal string representation of the hash of bitcoin block
635,010This block has not been mined yet at the time of starting the provably fair seeding event, proving that I have not deliberately picked a chain that is unfavorable for players.