3v4l.org

run code in 300+ 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 = 12
Branch analysis from position: 11
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 37, Position 2 = 39
Branch analysis from position: 37
1 jumps found. (Code = 42) Position 1 = 40
Branch analysis from position: 40
2 jumps found. (Code = 43) Position 1 = 49, Position 2 = 51
Branch analysis from position: 49
1 jumps found. (Code = 42) Position 1 = 52
Branch analysis from position: 52
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 51
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 39
2 jumps found. (Code = 43) Position 1 = 49, Position 2 = 51
Branch analysis from position: 49
Branch analysis from position: 51
Branch analysis from position: 10
Branch analysis from position: 7
filename:       /in/9Ykou
function name:  (null)
number of ops:  55
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, ->12
         11    > > EXIT                                                     'Fill+in+details'
   14    12    >   INIT_FCALL                                               'hash'
         13        SEND_VAL                                                 'sha256'
         14        SEND_VAR                                                 !1
         15        DO_ICALL                                         $12     
         16        ASSIGN                                                   !3, $12
   15    17        INIT_FCALL                                               'hash'
         18        SEND_VAL                                                 'sha256'
         19        CONCAT                                           ~14     !1, '%7C'
         20        CONCAT                                           ~15     ~14, !2
         21        SEND_VAL                                                 ~15
         22        DO_ICALL                                         $16     
         23        ASSIGN                                                   !4, $16
   16    24        INIT_FCALL                                               'hexdec'
         25        INIT_FCALL                                               'substr'
         26        SEND_VAR                                                 !4
         27        SEND_VAL                                                 0
         28        SEND_VAL                                                 8
         29        DO_ICALL                                         $18     
         30        SEND_VAR                                                 $18
         31        DO_ICALL                                         $19     
         32        MOD                                              ~20     $19, 2
         33        ADD                                              ~21     ~20, 1
         34        ASSIGN                                                   !5, ~21
   18    35        IS_EQUAL                                                 !0, !3
         36      > JMPZ                                                     ~23, ->39
         37    >   QM_ASSIGN                                        ~24     'Yes'
         38      > JMP                                                      ->40
         39    >   QM_ASSIGN                                        ~24     'No'
         40    >   CONCAT                                           ~25     'Hash+matches%3A+', ~24
         41        CONCAT                                           ~26     ~25, '%0A'
         42        ECHO                                                     ~26
   19    43        NOP                                                      
         44        FAST_CONCAT                                      ~27     'Generated+number%3A+', !5
         45        CONCAT                                           ~28     ~27, '%0A'
         46        ECHO                                                     ~28
   20    47        IS_EQUAL                                                 !5, 1
         48      > JMPZ                                                     ~29, ->51
         49    >   QM_ASSIGN                                        ~30     'CT+%28Blue+coin%29'
         50      > JMP                                                      ->52
         51    >   QM_ASSIGN                                        ~30     'T+%28Orange+coin%29'
         52    >   CONCAT                                           ~31     'Win+side%3A+', ~30
         53        ECHO                                                     ~31
         54      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
140.06 ms | 1007 KiB | 16 Q