3v4l.org

run code in 300+ PHP versions simultaneously
<?php function gen_secured_random() { // cause random is the way $a = rand(1337,2600)*42; $b = rand(1879,1955)*42; $a < $b ? $a ^= $b ^= $a ^= $b : $a = $b; return $a+$b; } function secured_hash_function($plain) { // cause md5 is the best hash ever $secured_plain = sanitize_user_input($plain); return md5($secured_plain); } function sanitize_user_input($input) { // cause someone told me to never trust user input $re = '/[^a-zA-Z0-9]/'; $secured_input = preg_replace($re, "", $input); return $secured_input; } $s = 's'; $h ='h'; print "s => "; var_dump($s); print "h => "; var_dump($h); if (isset($s) && isset($h )) { $s = sanitize_user_input($s); $h = secured_hash_function($h); $r = gen_secured_random(); echo "strans => " ; var_dump($s); echo "htrans => " ; var_dump($h); echo "rtrans => " ; var_dump($r); if($s != false && $h != false) { if($s.$r == $h) { print "Well done! Here is your flag: "; } else { print "Fail..."; } } else { print "<p>Hum ...</p>"; } } ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 12, Position 2 = 14
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 51
Branch analysis from position: 15
2 jumps found. (Code = 46) Position 1 = 40, Position 2 = 42
Branch analysis from position: 40
2 jumps found. (Code = 43) Position 1 = 43, Position 2 = 50
Branch analysis from position: 43
2 jumps found. (Code = 43) Position 1 = 46, Position 2 = 48
Branch analysis from position: 46
1 jumps found. (Code = 42) Position 1 = 49
Branch analysis from position: 49
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: 48
1 jumps found. (Code = 42) Position 1 = 51
Branch analysis from position: 51
Branch analysis from position: 50
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 42
Branch analysis from position: 51
Branch analysis from position: 14
filename:       /in/d5ao2
function name:  (null)
number of ops:  52
compiled vars:  !0 = $s, !1 = $h, !2 = $r
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   ASSIGN                                                   !0, 's'
   23     1        ASSIGN                                                   !1, 'h'
   25     2        ECHO                                                     's+%3D%3E+'
   26     3        INIT_FCALL                                               'var_dump'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                                 
   27     6        ECHO                                                     'h+%3D%3E+'
   28     7        INIT_FCALL                                               'var_dump'
          8        SEND_VAR                                                 !1
          9        DO_ICALL                                                 
   30    10        ISSET_ISEMPTY_CV                                 ~7      !0
         11      > JMPZ_EX                                          ~7      ~7, ->14
         12    >   ISSET_ISEMPTY_CV                                 ~8      !1
         13        BOOL                                             ~7      ~8
         14    > > JMPZ                                                     ~7, ->51
   31    15    >   INIT_FCALL                                               'sanitize_user_input'
         16        SEND_VAR                                                 !0
         17        DO_FCALL                                      0  $9      
         18        ASSIGN                                                   !0, $9
   32    19        INIT_FCALL                                               'secured_hash_function'
         20        SEND_VAR                                                 !1
         21        DO_FCALL                                      0  $11     
         22        ASSIGN                                                   !1, $11
   33    23        INIT_FCALL                                               'gen_secured_random'
         24        DO_FCALL                                      0  $13     
         25        ASSIGN                                                   !2, $13
   35    26        ECHO                                                     'strans+%3D%3E+'
         27        INIT_FCALL                                               'var_dump'
         28        SEND_VAR                                                 !0
         29        DO_ICALL                                                 
   36    30        ECHO                                                     'htrans+%3D%3E+'
         31        INIT_FCALL                                               'var_dump'
         32        SEND_VAR                                                 !1
         33        DO_ICALL                                                 
   37    34        ECHO                                                     'rtrans+%3D%3E+'
         35        INIT_FCALL                                               'var_dump'
         36        SEND_VAR                                                 !2
         37        DO_ICALL                                                 
   39    38        BOOL                                             ~18     !0
         39      > JMPZ_EX                                          ~18     ~18, ->42
         40    >   BOOL                                             ~19     !1
         41        BOOL                                             ~18     ~19
         42    > > JMPZ                                                     ~18, ->50
   40    43    >   CONCAT                                           ~20     !0, !2
         44        IS_EQUAL                                                 !1, ~20
         45      > JMPZ                                                     ~21, ->48
   41    46    >   ECHO                                                     'Well+done%21+Here+is+your+flag%3A+'
         47      > JMP                                                      ->49
   44    48    >   ECHO                                                     'Fail...'
         49    > > JMP                                                      ->51
   48    50    >   ECHO                                                     '%3Cp%3EHum+...%3C%2Fp%3E'
   51    51    > > RETURN                                                   1

Function gen_secured_random:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 19
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/d5ao2
function name:  gen_secured_random
number of ops:  25
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'rand'
          1        SEND_VAL                                                 1337
          2        SEND_VAL                                                 2600
          3        DO_ICALL                                         $2      
          4        MUL                                              ~3      $2, 42
          5        ASSIGN                                                   !0, ~3
    4     6        INIT_FCALL                                               'rand'
          7        SEND_VAL                                                 1879
          8        SEND_VAL                                                 1955
          9        DO_ICALL                                         $5      
         10        MUL                                              ~6      $5, 42
         11        ASSIGN                                                   !1, ~6
    6    12        IS_SMALLER                                               !0, !1
         13      > JMPZ                                                     ~8, ->19
         14    >   ASSIGN_OP                                    11  ~9      !0, !1
         15        ASSIGN_OP                                    11  ~10     !1, ~9
         16        ASSIGN_OP                                    11  ~11     !0, ~10
         17        QM_ASSIGN                                        ~12     ~11
         18      > JMP                                                      ->21
         19    >   ASSIGN                                           ~13     !0, !1
         20        QM_ASSIGN                                        ~12     ~13
         21    >   FREE                                                     ~12
    8    22        ADD                                              ~14     !0, !1
         23      > RETURN                                                   ~14
    9    24*     > RETURN                                                   null

End of function gen_secured_random

Function secured_hash_function:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/d5ao2
function name:  secured_hash_function
number of ops:  10
compiled vars:  !0 = $plain, !1 = $secured_plain
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
   12     1        INIT_FCALL_BY_NAME                                       'sanitize_user_input'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0  $2      
          4        ASSIGN                                                   !1, $2
   13     5        INIT_FCALL                                               'md5'
          6        SEND_VAR                                                 !1
          7        DO_ICALL                                         $4      
          8      > RETURN                                                   $4
   14     9*     > RETURN                                                   null

End of function secured_hash_function

Function sanitize_user_input:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/d5ao2
function name:  sanitize_user_input
number of ops:  10
compiled vars:  !0 = $input, !1 = $re, !2 = $secured_input
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
   17     1        ASSIGN                                                   !1, '%2F%5B%5Ea-zA-Z0-9%5D%2F'
   18     2        INIT_FCALL                                               'preg_replace'
          3        SEND_VAR                                                 !1
          4        SEND_VAL                                                 ''
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $4      
          7        ASSIGN                                                   !2, $4
   19     8      > RETURN                                                   !2
   20     9*     > RETURN                                                   null

End of function sanitize_user_input

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.66 ms | 1407 KiB | 24 Q