Hello all! We're back again prepping another game before our launch. The game for this seeding event will be our original game Turbo Crash
As usual, we've generated a new chain of 10,000,000 SHA256 hashes where each hash is the hash of the hexadecimal representation of the previous hash. Being the last hash in the chain: b535ff510fe8612ce309a5b264f85d22ad3832c88f13d14cce0910e5f768279f
Code:
const { createHmac } = require('crypto');
const divisible = (hash, mod) => {
// So ABCDEFGHIJ should be chunked like AB CDEF GHIJ
let val = 0;
let o = hash.length % 4;
for (let i = o > 0 ? o - 4 : 0; i < hash.length; i += 4) {
val = ((val << 16) + parseInt(hash.substring(i, i + 4), 16)) % mod;
}
return val === 0;
};
const calculateCrashPointFromHash = function (hash) {
// In 1 of 15 games the game crashes instantly.
if (divisible(hash, 15)) return 0;
// Use the most significant 52-bit from the hash to calculate the crash point
let h = parseInt(hash.slice(0, 52 / 4), 16);
let e = Math.pow(2, 52);
return (Math.floor((100 * e - h) / (e - h)) / 100).toFixed(2);
};
// these will be the 10M pre generated rolls to be used
const hashChain = ['random1', 'random2'];
const gameHash = hashChain.pop();
const blockHash = '';
const hash = createHmac('sha256', gameHash).update(blockHash).digest('hex');
const crashPoint = calculateCrashPointFromHash(hash);
console.log({ crashPoint });
We’re gonna be using a BlockHash that hasn’t been mined at the time of this post, we’re expecting to use Bitcoin block 834,217 this to prove we have no influence over the outcome of the game. Please guys feel free to quote this post so this will be all set in stone.
Looking forward to show you guys Turbo Crash very soon!