<?php /* * Fill in all four below and click the blue 'eval();' button. * ------------------ */ $server_seed = "204cbf2b6c7d3df52d5fce91c83ec4f1c77614df8dd3336629c7dd5bd87ec4c5"; $public_seed = "0929140631"; $round = "12158349"; /* ------------------ */ $hash = hash_hmac('sha256', $public_seed . "-" . $round, $server_seed); $decimal_hash = '0'; $length = strlen($hash); for ($i = 0; $i < $length; $i++) { $decimal_hash = bcmul($decimal_hash, '16'); // Multiply by base 16 $decimal_hash = bcadd($decimal_hash, hexdec($hash[$i])); // Add the current digit } // Apply modulo to get the roll $roll = bcmod($decimal_hash, '15'); // Use modulo 15 to get the roll if ($roll == 0) $roll_colour = 'bonus'; elseif ($roll >= 1 and $roll <= 7) $roll_colour = 'orange'; elseif ($roll >= 8 and $roll <= 14) $roll_colour = 'black'; echo("Roll: $roll\nColour: $roll_colour");
You have javascript disabled. You will not be able to edit any code.