3v4l.org

run code in 300+ PHP versions simultaneously
<?php $defaultdata = json_encode(array( "showpassword"=>"yes", "bgcolor"=>"#ffffff")); function xor_decrypt($in) { if ($in != ''){ $text = $in; $key = json_encode(array( "showpassword"=>"no", "bgcolor"=>"#ffffff"));} else{ $text = json_encode(array( "showpassword"=>"yes", "bgcolor"=>"#ffffff")); $key = "qw8J";} // Iterate through each character $outText = ''; for($i=0;$i<strlen($text);$i++) { $outText .= $text[$i] ^ $key[$i % strlen($key)]; } return $outText; } print "Key is currently unknown.\n OriginalData ^ Key = CipherText\n\t"; print " so that also means,\n OriginalData ^ Ciphertext = Key\n Therefore the key will repeat itself: "; print xor_decrypt(base64_decode("HmYkBwozJw4WNyAAFyB1VUcqOE1JZjUIBis7ABdmbU1GIjEJAyIxTRg=")); print "\nNow that we know the key lets create a new cookie to display the password: \n"; print base64_encode(xor_decrypt("")); print "\n"; ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/1BCmH
function name:  (null)
number of ops:  23
compiled vars:  !0 = $defaultdata
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'json_encode'
          1        SEND_VAL                                                 <array>
          2        DO_ICALL                                         $1      
          3        ASSIGN                                                   !0, $1
   19     4        ECHO                                                     'Key+is+currently+unknown.%0A+OriginalData+%5E+Key+%3D+CipherText%0A%09'
   20     5        ECHO                                                     '+so+that+also+means%2C%0A+OriginalData+%5E+Ciphertext+%3D+Key%0A+Therefore+the+key+will+repeat+itself%3A+'
   21     6        INIT_FCALL                                               'xor_decrypt'
          7        INIT_FCALL                                               'base64_decode'
          8        SEND_VAL                                                 'HmYkBwozJw4WNyAAFyB1VUcqOE1JZjUIBis7ABdmbU1GIjEJAyIxTRg%3D'
          9        DO_ICALL                                         $3      
         10        SEND_VAR                                                 $3
         11        DO_FCALL                                      0  $4      
         12        ECHO                                                     $4
   22    13        ECHO                                                     '%0ANow+that+we+know+the+key+lets+create+a+new+cookie+to+display+the+password%3A+%0A'
   23    14        INIT_FCALL                                               'base64_encode'
         15        INIT_FCALL                                               'xor_decrypt'
         16        SEND_VAL                                                 ''
         17        DO_FCALL                                      0  $5      
         18        SEND_VAR                                                 $5
         19        DO_ICALL                                         $6      
         20        ECHO                                                     $6
   24    21        ECHO                                                     '%0A'
   25    22      > RETURN                                                   1

Function xor_decrypt:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 9
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
2 jumps found. (Code = 44) Position 1 = 27, Position 2 = 17
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
2 jumps found. (Code = 44) Position 1 = 27, Position 2 = 17
Branch analysis from position: 27
Branch analysis from position: 17
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
filename:       /in/1BCmH
function name:  xor_decrypt
number of ops:  29
compiled vars:  !0 = $in, !1 = $text, !2 = $key, !3 = $outText, !4 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        IS_NOT_EQUAL                                             !0, ''
          2      > JMPZ                                                     ~5, ->9
    5     3    >   ASSIGN                                                   !1, !0
    6     4        INIT_FCALL                                               'json_encode'
          5        SEND_VAL                                                 <array>
          6        DO_ICALL                                         $7      
          7        ASSIGN                                                   !2, $7
    4     8      > JMP                                                      ->14
    8     9    >   INIT_FCALL                                               'json_encode'
         10        SEND_VAL                                                 <array>
         11        DO_ICALL                                         $9      
         12        ASSIGN                                                   !1, $9
    9    13        ASSIGN                                                   !2, 'qw8J'
   12    14    >   ASSIGN                                                   !3, ''
   13    15        ASSIGN                                                   !4, 0
         16      > JMP                                                      ->24
   14    17    >   FETCH_DIM_R                                      ~14     !1, !4
         18        STRLEN                                           ~15     !2
         19        MOD                                              ~16     !4, ~15
         20        FETCH_DIM_R                                      ~17     !2, ~16
         21        BW_XOR                                           ~18     ~14, ~17
         22        ASSIGN_OP                                     8          !3, ~18
   13    23        PRE_INC                                                  !4
         24    >   STRLEN                                           ~21     !1
         25        IS_SMALLER                                               !4, ~21
         26      > JMPNZ                                                    ~22, ->17
   16    27    > > RETURN                                                   !3
   17    28*     > RETURN                                                   null

End of function xor_decrypt

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
142.43 ms | 962 KiB | 18 Q