Author

Topic: RollCat.io Seeding Event (Read 100 times)

legendary
Activity: 2562
Merit: 1414
June 23, 2023, 01:40:22 PM
#3
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 Smiley

Update: the block 795604 has been mined!

The final salt is: 00000000000000000002c1532ff9294c970e471e26ea8575324df82290386706

No problem, quoting both of these for future reference
newbie
Activity: 7
Merit: 0
June 23, 2023, 01:32:19 PM
#2
Update: the block 795604 has been mined!

The final salt is: 00000000000000000002c1532ff9294c970e471e26ea8575324df82290386706
newbie
Activity: 7
Merit: 0
June 23, 2023, 12:41:35 PM
#1
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 Smiley
Jump to: