- Cuenta
- Próximo Hash de Semilla
- Semilla Revelada
- Resultado del Giro
- 0
#!/usr/bin/env node
const crypto = require("crypto");
const uid = "";
const revealedSeed = "";
// SHA-256 commitment of the revealed server seed.
// Compare this with the seed hash that was shown before the spin.
function sha256(payload) {
return crypto.createHash("sha256").update(payload).digest("hex");
}
// Exact roulette result algorithm used by the backend.
function calculateLuckyNumber(payload, secret) {
const hmac = crypto
.createHmac("sha512", payload)
.update(secret)
.digest("hex");
const first7 = hmac.substring(0, 7);
return parseInt(first7, 16) % 37;
}
console.log("Revealed seed hash:", sha256(revealedSeed));
console.log("Lucky number:", calculateLuckyNumber(uid, revealedSeed));
// Expected lucky number: 0