3v4l.org

run code in 500+ PHP versions simultaneously
<?php $server_seed = '83cd8d18b416bbdd22fa25135608b197'; $client_seeds = 'rnNOy5IWg1TEZfSC0U0CQNGAUFnB5C5Fc3e5a7e0cd2411dc5da8e3e716cc10300c791ffce0742d6c2243b253363f9591KGmiyM8wxtsiGTXt'; $targets = [ 1 => 71459, 2 => 68973, 3 => 92006, 4 => 27155 ]; echo "--- HELLCASE 'SWAPPED' V2 AUDIT ---\n"; foreach ($targets as $nonce => $target_roll) { // VARIATION C: We use the Client Seeds as the KEY and the Server Seed + Nonce as the MESSAGE $message = $server_seed . ':' . $nonce; $hash = hash_hmac('sha256', $message, $client_seeds); $hex_8 = substr($hash, 0, 8); $decimal = hexdec($hex_8); $roll_calculated = ($decimal % 1000000) + 1; echo "Nonce [$nonce]: Calculated: $roll_calculated | Expected: $target_roll -> "; echo ($roll_calculated == $target_roll ? "✅ MATCH!\n" : "❌ FAIL\n"); } ?> <?php $server_seed = '83cd8d18b416bbdd22fa25135608b197'; $client_seeds = 'rnNOy5IWg1TEZfSC0U0CQNGAUFnB5C5Fc3e5a7e0cd2411dc5da8e3e716cc10300c791ffce0742d6c2243b253363f9591KGmiyM8wxtsiGTXt'; $targets = [ 1 => 71459, 2 => 68973, 3 => 92006, 4 => 27155 ]; echo "--- HELLCASE 'SWAPPED' V2 AUDIT ---\n"; foreach ($targets as $nonce => $target_roll) { // VARIATION C: We use the Client Seeds as the KEY and the Server Seed + Nonce as the MESSAGE $message = $server_seed . ':' . $nonce; $hash = hash_hmac('sha256', $message, $client_seeds); $hex_8 = substr($hash, 0, 8); $decimal = hexdec($hex_8); $roll_calculated = ($decimal % 1000000) + 1; echo "Nonce [$nonce]: Calculated: $roll_calculated | Expected: $target_roll -> "; echo ($roll_calculated == $target_roll ? "✅ MATCH!\n" : "❌ FAIL\n"); } ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 41
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 41
Branch analysis from position: 6
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
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 38
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 41
2 jumps found. (Code = 77) Position 1 = 47, Position 2 = 83
Branch analysis from position: 47
2 jumps found. (Code = 78) Position 1 = 48, Position 2 = 83
Branch analysis from position: 48
2 jumps found. (Code = 43) Position 1 = 78, Position 2 = 80
Branch analysis from position: 78
1 jumps found. (Code = 42) Position 1 = 81
Branch analysis from position: 81
1 jumps found. (Code = 42) Position 1 = 47
Branch analysis from position: 47
Branch analysis from position: 80
1 jumps found. (Code = 42) Position 1 = 47
Branch analysis from position: 47
Branch analysis from position: 83
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 83
Branch analysis from position: 41
filename:       /in/ilsiF
function name:  (null)
number of ops:  85
compiled vars:  !0 = $server_seed, !1 = $client_seeds, !2 = $targets, !3 = $target_roll, !4 = $nonce, !5 = $message, !6 = $hash, !7 = $hex_8, !8 = $decimal, !9 = $roll_calculated
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                       !0, '83cd8d18b416bbdd22fa25135608b197'
    3     1        ASSIGN                                                       !1, 'rnNOy5IWg1TEZfSC0U0CQNGAUFnB5C5Fc3e5a7e0cd2411dc5da8e3e716cc10300c791ffce0742d6c2243b253363f9591KGmiyM8wxtsiGTXt'
    5     2        ASSIGN                                                       !2, <array>
   12     3        ECHO                                                         '---+HELLCASE+%27SWAPPED%27+V2+AUDIT+---%0A'
   14     4      > FE_RESET_R                                           $13     !2, ->41
          5    > > FE_FETCH_R                                           ~14     $13, !3, ->41
          6    >   ASSIGN                                                       !4, ~14
   16     7        CONCAT                                               ~16     !0, '%3A'
          8        CONCAT                                               ~17     ~16, !4
          9        ASSIGN                                                       !5, ~17
   17    10        INIT_FCALL                                                   'hash_hmac'
         11        SEND_VAL                                                     'sha256'
         12        SEND_VAR                                                     !5
         13        SEND_VAR                                                     !1
         14        DO_ICALL                                             $19     
         15        ASSIGN                                                       !6, $19
   19    16        FRAMELESS_ICALL_3                substr              ~21     !6, 0
         17        OP_DATA                                                      8
         18        ASSIGN                                                       !7, ~21
   20    19        INIT_FCALL                                                   'hexdec'
         20        SEND_VAR                                                     !7
         21        DO_ICALL                                             $23     
         22        ASSIGN                                                       !8, $23
   21    23        MOD                                                  ~25     !8, 1000000
         24        ADD                                                  ~26     ~25, 1
         25        ASSIGN                                                       !9, ~26
   23    26        ROPE_INIT                                         7  ~29     'Nonce+%5B'
         27        ROPE_ADD                                          1  ~29     ~29, !4
         28        ROPE_ADD                                          2  ~29     ~29, '%5D%3A+Calculated%3A+'
         29        ROPE_ADD                                          3  ~29     ~29, !9
         30        ROPE_ADD                                          4  ~29     ~29, '+%7C+Expected%3A+'
         31        ROPE_ADD                                          5  ~29     ~29, !3
         32        ROPE_END                                          6  ~28     ~29, '+-%3E+'
         33        ECHO                                                         ~28
   24    34        IS_EQUAL                                                     !9, !3
         35      > JMPZ                                                         ~33, ->38
         36    >   QM_ASSIGN                                            ~34     '%E2%9C%85+MATCH%21%0A'
         37      > JMP                                                          ->39
         38    >   QM_ASSIGN                                            ~34     '%E2%9D%8C+FAIL%0A'
         39    >   ECHO                                                         ~34
   14    40      > JMP                                                          ->5
         41    >   FE_FREE                                                      $13
   28    42        ASSIGN                                                       !0, '83cd8d18b416bbdd22fa25135608b197'
   29    43        ASSIGN                                                       !1, 'rnNOy5IWg1TEZfSC0U0CQNGAUFnB5C5Fc3e5a7e0cd2411dc5da8e3e716cc10300c791ffce0742d6c2243b253363f9591KGmiyM8wxtsiGTXt'
   31    44        ASSIGN                                                       !2, <array>
   38    45        ECHO                                                         '---+HELLCASE+%27SWAPPED%27+V2+AUDIT+---%0A'
   40    46      > FE_RESET_R                                           $38     !2, ->83
         47    > > FE_FETCH_R                                           ~39     $38, !3, ->83
         48    >   ASSIGN                                                       !4, ~39
   42    49        CONCAT                                               ~41     !0, '%3A'
         50        CONCAT                                               ~42     ~41, !4
         51        ASSIGN                                                       !5, ~42
   43    52        INIT_FCALL                                                   'hash_hmac'
         53        SEND_VAL                                                     'sha256'
         54        SEND_VAR                                                     !5
         55        SEND_VAR                                                     !1
         56        DO_ICALL                                             $44     
         57        ASSIGN                                                       !6, $44
   45    58        FRAMELESS_ICALL_3                substr              ~46     !6, 0
         59        OP_DATA                                                      8
         60        ASSIGN                                                       !7, ~46
   46    61        INIT_FCALL                                                   'hexdec'
         62        SEND_VAR                                                     !7
         63        DO_ICALL                                             $48     
         64        ASSIGN                                                       !8, $48
   47    65        MOD                                                  ~50     !8, 1000000
         66        ADD                                                  ~51     ~50, 1
         67        ASSIGN                                                       !9, ~51
   49    68        ROPE_INIT                                         7  ~54     'Nonce+%5B'
         69        ROPE_ADD                                          1  ~54     ~54, !4
         70        ROPE_ADD                                          2  ~54     ~54, '%5D%3A+Calculated%3A+'
         71        ROPE_ADD                                          3  ~54     ~54, !9
         72        ROPE_ADD                                          4  ~54     ~54, '+%7C+Expected%3A+'
         73        ROPE_ADD                                          5  ~54     ~54, !3
         74        ROPE_END                                          6  ~53     ~54, '+-%3E+'
         75        ECHO                                                         ~53
   50    76        IS_EQUAL                                                     !9, !3
         77      > JMPZ                                                         ~58, ->80
         78    >   QM_ASSIGN                                            ~59     '%E2%9C%85+MATCH%21%0A'
         79      > JMP                                                          ->81
         80    >   QM_ASSIGN                                            ~59     '%E2%9D%8C+FAIL%0A'
         81    >   ECHO                                                         ~59
   40    82      > JMP                                                          ->47
         83    >   FE_FREE                                                      $38
   52    84      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
156.62 ms | 1353 KiB | 15 Q