Created
December 19, 2018 11:47
-
-
Save nining/03c5c6e7afe9c9934ca51c44daec226a to your computer and use it in GitHub Desktop.
// source https://jsbin.com
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta name="description" content="[add your bin description]"> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script src="https://cdn.bootcss.com/crypto-js/3.1.9/core.js"></script> | |
<script src="https://cdn.bootcss.com/crypto-js/3.1.9/crypto-js.js"></script> | |
<script src="https://cdn.bootcss.com/crypto-js/3.1.9/sha256.js"></script> | |
<script src="https://cdn.bootcss.com/crypto-js/3.1.9/sha512.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/bignumber.js/8.0.1/bignumber.min.js"></script> | |
<script id="jsbin-javascript"> | |
// bet_id: 70553 | |
// 服务端种子 | |
var server_seed = "a10d8ff000ce8639828d1d3c0885fe10f3e89c540e45e75d28b81602b77e3cc8"; | |
// 客户端哈希 | |
var client_hash = "3170e25495b1aaff2bc4536b21ce3afed4595923"; | |
var newdata = CryptoJS.enc.Hex.parse(server_seed + client_hash); | |
var hash256 = CryptoJS.SHA256(newdata ).toString(CryptoJS.enc.Hex); | |
var big = new BigNumber(hash256, 16); | |
var result = big.mod(100) < 50 ? "small" : "big"; | |
console.log('result: ' + result) | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript"> | |
// bet_id: 70553 | |
// 服务端种子 | |
var server_seed = "a10d8ff000ce8639828d1d3c0885fe10f3e89c540e45e75d28b81602b77e3cc8"; | |
// 客户端哈希 | |
var client_hash = "3170e25495b1aaff2bc4536b21ce3afed4595923"; | |
var newdata = CryptoJS.enc.Hex.parse(server_seed + client_hash); | |
var hash256 = CryptoJS.SHA256(newdata ).toString(CryptoJS.enc.Hex); | |
var big = new BigNumber(hash256, 16); | |
var result = big.mod(100) < 50 ? "small" : "big"; | |
console.log('result: ' + result) | |
</script></body> | |
</html> |
This file contains 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
// bet_id: 70553 | |
// 服务端种子 | |
var server_seed = "a10d8ff000ce8639828d1d3c0885fe10f3e89c540e45e75d28b81602b77e3cc8"; | |
// 客户端哈希 | |
var client_hash = "3170e25495b1aaff2bc4536b21ce3afed4595923"; | |
var newdata = CryptoJS.enc.Hex.parse(server_seed + client_hash); | |
var hash256 = CryptoJS.SHA256(newdata ).toString(CryptoJS.enc.Hex); | |
var big = new BigNumber(hash256, 16); | |
var result = big.mod(100) < 50 ? "small" : "big"; | |
console.log('result: ' + result) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment