Post
Topic
Board Gambling discussion
Re: bustabit.com - New seeding event
by
KloNEM
on 27/02/2024, 08:39:26 UTC
In the "previous bustabit", I used this part of code for calculating hash and game result :

Code:
var CryptoJS = require('./node_modules/crypto-js/crypto-js.js');
var isVerifying = false;

  var hash_input = process.argv[2];

  let prevHash = null;
 
  while (prevHash != 'f7a0cc38f223a24f40ca70faa4adb433be79be3eaf9ac8b37da39f57f1f8ed62') {
    let hash = String(prevHash ? CryptoJS.SHA256(String(prevHash)) : hash_input);
    let bust = gameResult(hash, '0000000000000000004d6ec16dafe9d8370958664c1dc422f452892264c59526');
   
    console.log(bust, hash);

    prevHash = hash;
  }

function gameResult(seed, salt) {
  const nBits = 52; // number of most significant bits to use

  // 1. HMAC_SHA256(message=seed, key=salt) 
  const hmac = CryptoJS.HmacSHA256(CryptoJS.enc.Hex.parse(seed), salt);
  seed = hmac.toString(CryptoJS.enc.Hex);

  // 2. r = 52 most significant bits
  seed = seed.slice(0, nBits / 4);
  const r = parseInt(seed, 16);

  // 3. X = r / 2^52
  let X = r / Math.pow(2, nBits); // uniformly distributed in [0; 1)

  // 4. X = 99 / (1-X)
  X = 99 / (1 - X);

  // 5. return max(trunc(X), 100)
  const result = Math.floor(X);
  return Math.max(1, result / 100);
};

E.g. this is "prevHash" for game #7600000 (so I'm able to count all the games from #7600000 till hash of the game as a parameter of this script). So I supposed, when I replace this prevHash with (e.g.) hash of game #10000001, and change salt ("let bust = gameResult" row) to the new one ( 000000000000000000011f6e135efe67d7463dfe7bb955663ef88b1243b2deea), everything will work again. But it is not Wink. So, could you tell me, please, how could I extend this script (vxSignature is necessary?), for properly working again? Thanks a lot!