CrashMoney - Game Verification Script
Third party script used to verify games on CrashMoney.
by Vulcano
HTML
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.6.2/css/bulma.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.9-1/crypto-js.min.js"></script>
<section class="section">
<div class="container">
<h1 class="title">CrashMoney - Game Verification Script</h1>
<h2 class="subtitle">
Third party script used to verify games on CrashMoney.io .
</h2>
</div>
<hr>
<div class="container">
<div class="field">
<p class="control has-icons-left">
<input class="input" type="text" id="game_hash_input" placeholder="Game's hash (SHA256)">
<span class="icon is-small is-left">
<i class="fa fa-key"></i>
</span>
</p>
</div>
<div class="field">
<p class="control has-icons-left">
<input class="input" type="number" id="game_amount_input" min="1" max="100000" step="1" placeholder="Amount of games" value="10">
<span class="icon is-small is-left">
<i class="fa fa-hashtag"></i>
</span>
</p>
</div>
<div class="field is-grouped">
<p class="control">
<a class="button is-primary" id="game_verify_submit">
Verify
</a>
</p>
</div>
</div>
<hr>
<div class="container">
<table class="table is-striped is-fullwidth is-hoverable is-narrow">
<thead>
<tr>
<th><b>Game's hash</b></th>
<th><b>Bust</b></th>
</tr>
</thead>
<tbody id="game_verify_table"></tbody>
</table>
</div>
</section>
CSS
table {
table-layout: fixed;
}
table thead tr th:first-child {
width: 80%;
}
table tbody tr td {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.is-first {
background-color: rgba(195, 111, 24, 0.2);
}
.is-over-median {
color: #44B39D;
}
.is-at-median {
color: #3B3C3D;
}
.is-under-median {
color: #BF4A67;
}
JavaScript
var isVerifying = false;
$('#game_verify_submit').on('click', () => {
if (isVerifying) return;
isVerifying = true;
$('#game_hash_input').parent().addClass('is-loading');
$('#game_verify_submit').addClass('is-loading');
$('#game_hash_input, #game_amount_input, #game_verify_submit').attr('disabled', 'disabled');
$('#game_verify_table').html('');
let prevHash = null;
for (let i = 0; i < $('#game_amount_input').val(); i++) {
let hash = String(prevHash ? CryptoJS.SHA256(String(prevHash)) : $('#game_hash_input').val());
let bust = gameResult(hash, '00000000000000000017675f966ee8a52a92298b1c3dd05ef52de1b28516c8e9');
setTimeout(function() {
addTableRow(hash, bust, i);
}, i * 1);
prevHash = hash;
}
});
$('#game_amount_input').on('keyup', () => {
if ($('#game_amount_input').val() >= 10000) {
if ($('#game_verify_warning').length) return;
$('#game_verify_submit').parent().append(
$('<span/>').attr({
'id': 'game_verify_warning',
'class': 'tag is-warning'
}).text("Verifying a huge amount of games may consume more ressources from your CPU")
);
} else {
if ($('#game_verify_warning').length) {
$('#game_verify_warning').remove();
}
}
});
const addTableRow = (hash, bust, index) => {
$('<tr/>').attr({
'class': index === 0 ? 'is-first' : null
}).append(
$('<td/>').text(hash)
).append(
$('<td/>').text(bust).attr({
'class': bust === 1.98 ? 'is-at-median' : bust > 1.98 ? 'is-over-median' : 'is-under-median'
})
).appendToWithIndex($('#game_verify_table'), index);
if (index >= $('#game_amount_input').val() - 1) {
$('#game_hash_input').parent().removeClass('is-loading');
$('#game_verify_submit').removeClass('is-loading');
$('#game_hash_input, #game_amount_input, #game_verify_submit').removeAttr("disabled");
isVerifying = false;
}
};
const gameResult = (seed, salt) => {
const nBits = 52; // number of most significant bits to use
...