可验证公平的轮盘赌
验证您的最后交易结果,自行运行下面的代码
- 账户
- 下一个种子哈希
- 揭示的种子
- 自旋结果
- 0
#!/usr/bin/env node
const crypto = require("crypto");
// calculate hash from seed
function hash() {
return crypto.createHash("sha256").update(
""
).digest("hex");
};
function calculateNumber () {
const hmac = crypto
.createHmac("sha512", "")
.update(
""
)
.digest("hex");
const first7 = hmac.substring(0, 7);
return Math.round(parseInt(first7, 16)
/ 33);
}
// caculateNumber() === 0