Conditions | 2 |
Paths | 1 |
Total Lines | 11 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
45 | public function __invoke(string $serverSeed, string $clientSeed, int $nonce): float |
||
46 | { |
||
47 | $hash = hash_hmac('sha512', "${clientSeed}-${nonce}", $serverSeed); |
||
48 | $offset = 0; |
||
49 | |||
50 | do { |
||
51 | $number = hexdec(mb_substr($hash, $offset, 5)); |
||
52 | $offset += 5; |
||
53 | } while ($number >= 1000000); |
||
54 | |||
55 | return ($number % 10000) / 100; |
||
56 | } |
||
58 |