<?php
// //
// EmpireDrop Provably Fair Case Battles //
// //
/*
* Fill in all three below and click the blue 'eval();' button.
------------------ */
$server_seed = '';
$client_seed = '';
$nonce = $roundNumber = 0;
/* ------------------ */
if ($server_seed == '' || $client_seed == '' || $nonce < 0) {
echo "Fill in details";
return;
}
define('MIN_RESULT', 0.00001);
define('MAX_RESULT', 100);
define('CONVERT_RATE', 100000);
define('HASH_TYPE', 'sha256');
function getProvablyFairResult(string $client_seed, string $server_seed, int $nounce)
{
$hash = hash_hmac(HASH_TYPE, "{$client_seed}-{$nounce}", $server_seed);
$normalized = hexdec($hash) / (16 ** strlen($hash));
$roll = MIN_RESULT + $normalized * (MAX_RESULT - MIN_RESULT);
return convertDecimalValue($roll);
}
function convertDecimalValue(float $value): int
{
return round($value * CONVERT_RATE);
}
$result = getProvablyFairResult($client_seed, $server_seed, $nonce);
echo "Result: {$result}";
- Output for 8.1.0 - 8.1.29, 8.2.0 - 8.2.23, 8.3.0 - 8.3.11
- Fill in details
preferences:
43.1 ms | 406 KiB | 5 Q