3v4l.org

run code in 500+ PHP versions simultaneously
<?php /* * Fill in all five below and click blue 'eval();' button below textarea. * * ------------------ */ $game_seed_hash = ''; #SHA-256 Server SEED $game_seed = ''; #Server SEED $clients_seed = ''; #Client SEED /* ------------------ */ if ($game_seed_hash == '' || $game_seed == '' || $clients_seed == '') exit("Fill in details"); $game_seed_sha256 = hash('sha256', $game_seed); $hash = hash('sha256', $game_seed.'|'.$clients_seed); $num = hexdec(substr($hash, 0, 8)) % 2 + 1; echo "Hash matches: ".($game_seed_hash == $game_seed_sha256 ? 'Yes': 'No')."\n"; echo "Generated number: $num"."\n"; echo "Win side: ".($num == 1 ? 'CT (Blue coin)': 'T (Orange coin)');
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 5, Position 2 = 7
Branch analysis from position: 5
2 jumps found. (Code = 47) Position 1 = 8, Position 2 = 10
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 14
Branch analysis from position: 11
1 jumps found. (Code = 61) Position 1 = -2
Branch analysis from position: 14
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 = 48, Position 2 = 50
Branch analysis from position: 48
1 jumps found. (Code = 42) Position 1 = 51
Branch analysis from position: 51
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 50
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 38
2 jumps found. (Code = 43) Position 1 = 48, Position 2 = 50
Branch analysis from position: 48
Branch analysis from position: 50
Branch analysis from position: 10
Branch analysis from position: 7
filename:       /in/9Ykou
function name:  (null)
number of ops:  54
compiled vars:  !0 = $game_seed_hash, !1 = $game_seed, !2 = $clients_seed, !3 = $game_seed_sha256, !4 = $hash, !5 = $num
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    6     0  E >   ASSIGN                                                       !0, ''
    7     1        ASSIGN                                                       !1, ''
    8     2        ASSIGN                                                       !2, ''
   12     3        IS_EQUAL                                             ~9      !0, ''
          4      > JMPNZ_EX                                             ~9      ~9, ->7
          5    >   IS_EQUAL                                             ~10     !1, ''
          6        BOOL                                                 ~9      ~10
          7    > > JMPNZ_EX                                             ~9      ~9, ->10
          8    >   IS_EQUAL                                             ~11     !2, ''
          9        BOOL                                                 ~9      ~11
         10    > > JMPZ                                                         ~9, ->14
         11    > > INIT_FCALL                                                   'exit'
         12*       SEND_VAL                                                     'Fill+in+details'
         13*       DO_ICALL                                                     
   14    14    >   INIT_FCALL                                                   'hash'
         15        SEND_VAL                                                     'sha256'
         16        SEND_VAR                                                     !1
         17        DO_ICALL                                             $13     
         18        ASSIGN                                                       !3, $13
   15    19        INIT_FCALL                                                   'hash'
         20        SEND_VAL                                                     'sha256'
         21        CONCAT                                               ~15     !1, '%7C'
         22        CONCAT                                               ~16     ~15, !2
         23        SEND_VAL                                                     ~16
         24        DO_ICALL                                             $17     
         25        ASSIGN                                                       !4, $17
   16    26        INIT_FCALL                                                   'hexdec'
         27        FRAMELESS_ICALL_3                substr              ~19     !4, 0
         28        OP_DATA                                                      8
         29        SEND_VAL                                                     ~19
         30        DO_ICALL                                             $20     
         31        MOD                                                  ~21     $20, 2
         32        ADD                                                  ~22     ~21, 1
         33        ASSIGN                                                       !5, ~22
   18    34        IS_EQUAL                                                     !0, !3
         35      > JMPZ                                                         ~24, ->38
         36    >   QM_ASSIGN                                            ~25     'Yes'
         37      > JMP                                                          ->39
         38    >   QM_ASSIGN                                            ~25     'No'
         39    >   CONCAT                                               ~26     'Hash+matches%3A+', ~25
         40        CONCAT                                               ~27     ~26, '%0A'
         41        ECHO                                                         ~27
   19    42        NOP                                                          
         43        FAST_CONCAT                                          ~28     'Generated+number%3A+', !5
         44        CONCAT                                               ~29     ~28, '%0A'
         45        ECHO                                                         ~29
   20    46        IS_EQUAL                                                     !5, 1
         47      > JMPZ                                                         ~30, ->50
         48    >   QM_ASSIGN                                            ~31     'CT+%28Blue+coin%29'
         49      > JMP                                                          ->51
         50    >   QM_ASSIGN                                            ~31     'T+%28Orange+coin%29'
         51    >   CONCAT                                               ~32     'Win+side%3A+', ~31
         52        ECHO                                                         ~32
         53      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
157.75 ms | 1456 KiB | 16 Q