A Pen by trustdice.win on CodePen.
Created
June 25, 2025 11:42
-
-
Save Alan93MM/bbc64b4a2c86546fb62e6a0e54616747 to your computer and use it in GitHub Desktop.
Dice Verifier
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
<body> | |
<div class="container mt-5 pb-3 px-5"> | |
<form> | |
<h1 class="text-center p-3 alert-info"> | |
<a href="trustdice.win" target="_blank" class="alert-link"> <u>TRUSTDICE.WIN</u></a> BET VERIFIER | |
</h1> | |
<div class="seed"> | |
<div class="input-group mb-3"> | |
<div class="input-group-prepend"> | |
<span class="input-group-text"><b>Server Seed</b></span> | |
</div> | |
<input id="serverSeed" type="text" spellcheck="false" class="form-control"> | |
</div> | |
<div class="input-group mb-3"> | |
<div class="input-group-prepend"> | |
<span class="input-group-text"><b>Client Seed</b></span> | |
</div> | |
<input id="clientSeed" type="text" spellcheck="false" class="form-control"> | |
</div> | |
<div class="form-check-inline"> | |
<label class="form-check-label"> | |
<input type="radio" id="eosAccount" class="form-check-input" name="optradio">EOS Account User | |
</label> | |
</div> | |
<div class="form-check-inline"> | |
<label class="form-check-label"> | |
<input type="radio" id="regAccount" class="form-check-input" name="optradio">Register Account User | |
</label> | |
</div> | |
</div> | |
<hr class="my-4"> | |
<div class="result"> | |
<div class="input-group mb-3"> | |
<div class="input-group-prepend"> | |
<span class="input-group-text"><b>Roll Result</b></span> | |
</div> | |
<input id="rollResult" type="text" class="form-control" disabled> | |
</div> | |
<div class="input-group"> | |
<div class="input-group-prepend"> | |
<span class="input-group-text"><b>Jackpot Result</b></span> | |
</div> | |
<input id="jackpotResult" type="text" class="form-control" disabled> | |
</div> | |
</div> | |
</form> | |
</div> | |
</body> |
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
function resolveBet(serverSeed, clientSeed, salt) { | |
let userSeedHash = sha1(clientSeed); | |
let seed = serverSeed + userSeedHash + salt; | |
let hash = sha512(seed); | |
for(let i=0; i<24; i++) { | |
lucky = parseInt(hash.substring(i * 5, i * 5 + 5), 16); | |
if (lucky < 1000000) { | |
return parseInt(lucky / 100) % 100 + 1; | |
} | |
} | |
return 99; | |
} | |
function resolveJackpot(serverSeed, clientSeed, salt) { | |
let userSeedHash = sha1(clientSeed); | |
let seed = serverSeed + userSeedHash + salt; | |
let hash = sha256(seed); | |
let ret = 0, | |
mod = 1000000000 + 7; | |
for (let i = 0; i < 64; i++) { | |
let sum = 0; | |
for (let j = 0; j < 16; j++) { | |
sum += ret; | |
sum %= mod; | |
} | |
ret = (sum + parseInt(hash[i], 16)) % mod; | |
} | |
return parseInt(ret / 100) % 10000; | |
} | |
let $serverSeed = $('#serverSeed'); | |
let $clientSeed = $('#clientSeed'); | |
let $eosAccount = $('#eosAccount'); | |
let $regAccount = $('#regAccount'); | |
let $rollResult = $('#rollResult'); | |
let $jackpotResult = $('#jackpotResult'); | |
function updateResult() { | |
let serverSeed = $serverSeed.val(); | |
let clientSeed = $clientSeed.val(); | |
let salt = ""; | |
if ($regAccount.is(":checked")) { | |
salt = "trustdice"; | |
} | |
else if ($eosAccount.is(":checked")) { | |
salt = ""; | |
} | |
else { | |
$rollResult.val('<Empty User Type>'); | |
$jackpotResult.val('<Empty User Type>'); | |
} | |
if (!serverSeed) { | |
$rollResult.val('<Empty Server Seed>'); | |
$jackpotResult.val('<Empty Server Seed>'); | |
} else if (!clientSeed) { | |
$rollResult.val('<Empty Client Seed>'); | |
$jackpotResult.val('<Empty Client Seed>'); | |
} else { | |
let rollResult = resolveBet(serverSeed, clientSeed, salt); | |
let jackpotResult = resolveJackpot(serverSeed, clientSeed, salt); | |
$rollResult.val(rollResult); | |
$jackpotResult.val(("" + jackpotResult).padStart(4, "0")); | |
} | |
} | |
let query = URI(document.location.search).search(true) | |
$serverSeed.val(query.serverSeed); | |
$clientSeed.val(query.clientSeed); | |
if (query.accountFlag === "0") { | |
$eosAccount.click(); | |
} | |
if (query.accountFlag === "1") { | |
$regAccount.click(); | |
} | |
$eosAccount.on('click', updateResult); | |
$regAccount.on('click', updateResult); | |
$('form').keyup(updateResult).keyup(); |
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
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-sha1/0.6.0/sha1.min.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/URI.js/1.19.1/URI.min.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-sha256/0.3.2/sha256.min.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-sha512/0.8.0/sha512.min.js"></script> |
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
body { | |
background-color: #d1ecf1; | |
} | |
.input-group-text { | |
justify-content: flex-end | |
} | |
div.seed .input-group-text { | |
width: 120px; | |
} | |
div.result .input-group-text { | |
width: 140px; | |
} | |
div.seed, | |
div.result { | |
padding: 20px 16px; | |
border-radius: 3px; | |
} | |
div.seed { | |
background: #90c2ea8c; | |
} | |
div.hash { | |
background: #b1bcf794; | |
} | |
div.result { | |
background: #e8a8a89e; | |
} |
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
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet" /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment