3v4l.org

run code in 500+ PHP versions simultaneously
<?php $serverSeed = 'paste server seed here'; // 32 characters, e.g. 086127124b1bd0b3d8027aef9b89c6b9 $serverSalt = 'paste server salt here'; // 16 characters, e.g. 03859d44cfc338ee $publicHash = 'paste public hash here'; // 64 characters, published BEFORE you played $clientSeed = 'paste client seed here'; // your own seed, e.g. 123 $nonce = 0; // bet number for this seed pair, e.g. 6 $maxRoll = 100000; // "maxRoll" from the response $expectedRoll = 0; // "roll" from the response, e.g. 95808 // --------------- nothing to edit below this line --------------- // Check 1: the site published $publicHash before you played. If it equals the hash // of the seed + salt revealed afterwards, the seed cannot have been swapped later. $hashOk = hash_equals($publicHash, hash_hmac('sha256', $serverSeed, $serverSalt)); // Check 2: the roll comes only from the server seed, your seed and the bet number, // so anyone can recompute it and must get exactly the same number. $roll = (hexdec(substr(hash_hmac('sha512', $serverSeed, "$clientSeed-$nonce"), 0, 15)) % $maxRoll) + 1; printf("server seed matches the hash published before the bet: %s\n", $hashOk ? 'YES' : 'NO'); printf("roll recomputed from your data: %d (possible range 1..%d)\n", $roll, $maxRoll); printf("same roll as the site reported (%d): %s\n", $expectedRoll, $roll === $expectedRoll ? 'YES' : 'NO');
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 36, Position 2 = 38
Branch analysis from position: 36
1 jumps found. (Code = 42) Position 1 = 39
Branch analysis from position: 39
2 jumps found. (Code = 43) Position 1 = 51, Position 2 = 53
Branch analysis from position: 51
1 jumps found. (Code = 42) Position 1 = 54
Branch analysis from position: 54
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 53
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 38
2 jumps found. (Code = 43) Position 1 = 51, Position 2 = 53
Branch analysis from position: 51
Branch analysis from position: 53
filename:       /in/H2bDH
function name:  (null)
number of ops:  57
compiled vars:  !0 = $serverSeed, !1 = $serverSalt, !2 = $publicHash, !3 = $clientSeed, !4 = $nonce, !5 = $maxRoll, !6 = $expectedRoll, !7 = $hashOk, !8 = $roll
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, 'paste+server+seed+here'
    4     1        ASSIGN                                                       !1, 'paste+server+salt+here'
    5     2        ASSIGN                                                       !2, 'paste+public+hash+here'
    6     3        ASSIGN                                                       !3, 'paste+client+seed+here'
    7     4        ASSIGN                                                       !4, 0
    8     5        ASSIGN                                                       !5, 100000
    9     6        ASSIGN                                                       !6, 0
   15     7        INIT_FCALL                                                   'hash_equals'
          8        SEND_VAR                                                     !2
          9        INIT_FCALL                                                   'hash_hmac'
         10        SEND_VAL                                                     'sha256'
         11        SEND_VAR                                                     !0
         12        SEND_VAR                                                     !1
         13        DO_ICALL                                             $16     
         14        SEND_VAR                                                     $16
         15        DO_ICALL                                             $17     
         16        ASSIGN                                                       !7, $17
   19    17        INIT_FCALL                                                   'hexdec'
         18        INIT_FCALL                                                   'hash_hmac'
         19        SEND_VAL                                                     'sha512'
         20        SEND_VAR                                                     !0
         21        ROPE_INIT                                         3  ~20     !3
         22        ROPE_ADD                                          1  ~20     ~20, '-'
         23        ROPE_END                                          2  ~19     ~20, !4
         24        SEND_VAL                                                     ~19
         25        DO_ICALL                                             $22     
         26        FRAMELESS_ICALL_3                substr              ~23     $22, 0
         27        OP_DATA                                                      15
         28        SEND_VAL                                                     ~23
         29        DO_ICALL                                             $24     
         30        MOD                                                  ~25     $24, !5
         31        ADD                                                  ~26     ~25, 1
         32        ASSIGN                                                       !8, ~26
   21    33        INIT_FCALL                                                   'printf'
         34        SEND_VAL                                                     'server+seed+matches+the+hash+published+before+the+bet%3A+%25s%0A'
         35      > JMPZ                                                         !7, ->38
         36    >   QM_ASSIGN                                            ~28     'YES'
         37      > JMP                                                          ->39
         38    >   QM_ASSIGN                                            ~28     'NO'
         39    >   SEND_VAL                                                     ~28
         40        DO_ICALL                                                     
   22    41        INIT_FCALL                                                   'printf'
         42        SEND_VAL                                                     'roll+recomputed+from+your+data%3A+%25d++%28possible+range+1..%25d%29%0A'
         43        SEND_VAR                                                     !8
         44        SEND_VAR                                                     !5
         45        DO_ICALL                                                     
   23    46        INIT_FCALL                                                   'printf'
         47        SEND_VAL                                                     'same+roll+as+the+site+reported+%28%25d%29%3A+%25s%0A'
         48        SEND_VAR                                                     !6
         49        IS_IDENTICAL                                                 !8, !6
         50      > JMPZ                                                         ~31, ->53
         51    >   QM_ASSIGN                                            ~32     'YES'
         52      > JMP                                                          ->54
         53    >   QM_ASSIGN                                            ~32     'NO'
         54    >   SEND_VAL                                                     ~32
         55        DO_ICALL                                                     
         56      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
129.2 ms | 487 KiB | 11 Q