This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const crypto = require("crypto") | |
function gameResult(seed, salt) { | |
const nBits = 52 // number of most significant bits to use | |
// 1. HMAC_SHA256(key=salt, message=seed) | |
const hmac = crypto.createHmac("sha256", salt) | |
hmac.update(seed) | |
seed = hmac.digest("hex") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { createHash, createHmac } = require("crypto"); | |
const salt = "0000000000000000004d6ec16dafe9d8370958664c1dc422f452892264c59526"; // chosen in seeding event: https://bitcointalk.org/index.php?topic=2807542.msg28778130#msg28778130 | |
let [id, hash] = process.argv.slice(2); | |
id = Number(id); | |
if (Number.isNaN(id) || !Number.isSafeInteger(id) || id < 1) { | |
printUsageMessage(); | |
process.exit(1); |