Bitcoin Forum

Economy => Gambling => Topic started by: rollcat_io on June 23, 2023, 05:41:35 PM



Title: RollCat.io Seeding Event
Post by: rollcat_io on June 23, 2023, 05:41:35 PM
Welcome to our seeding event (thx Rhavar for the method)!

Starting with a secret we have generated 10 million SHA256 hash chain where each hash is the hash of the hexadecimal representation of the previous hash.

Last hash in the chain is: 10abd09447cea8db13aef1e23a05a058331c62289b712c15c413a0eb873049e1

Code to verify game results:
Code:
import { createHmac } from "crypto";

function result(hash, salt) {
  const CHUNK_SIZE = 8;
  const SECTIONS_COUNT = 54;

  const hmac = createHmac("sha256", salt);

  hmac.update(hash);

  let hex = hmac.digest("hex");

  const hexChunk = hex.substring(0, CHUNK_SIZE);
  const int = parseInt(hexChunk, 16);
  const float = int / 2 ** 32;

  return Math.floor(float * SECTIONS_COUNT);
}

Hexadecimal string representation of hash of bitcoin block 795604 will be our salt, as of posting this, this block has not been mined yet.

I'd appreciate it if someone could quote this post :)


Title: Re: RollCat.io Seeding Event
Post by: rollcat_io on June 23, 2023, 06:32:19 PM
Update: the block 795604 has been mined!

The final salt is: 00000000000000000002c1532ff9294c970e471e26ea8575324df82290386706


Title: Re: RollCat.io Seeding Event
Post by: arallmuus on June 23, 2023, 06:40:22 PM
Welcome to our seeding event (thx Rhavar for the method)!

Starting with a secret we have generated 10 million SHA256 hash chain where each hash is the hash of the hexadecimal representation of the previous hash.

Last hash in the chain is: 10abd09447cea8db13aef1e23a05a058331c62289b712c15c413a0eb873049e1

Code to verify game results:
Code:
import { createHmac } from "crypto";

function result(hash, salt) {
  const CHUNK_SIZE = 8;
  const SECTIONS_COUNT = 54;

  const hmac = createHmac("sha256", salt);

  hmac.update(hash);

  let hex = hmac.digest("hex");

  const hexChunk = hex.substring(0, CHUNK_SIZE);
  const int = parseInt(hexChunk, 16);
  const float = int / 2 ** 32;

  return Math.floor(float * SECTIONS_COUNT);
}

Hexadecimal string representation of hash of bitcoin block 795604 will be our salt, as of posting this, this block has not been mined yet.

I'd appreciate it if someone could quote this post :)

Update: the block 795604 has been mined!

The final salt is: 00000000000000000002c1532ff9294c970e471e26ea8575324df82290386706

No problem, quoting both of these for future reference