3v4l.org

run code in 300+ PHP versions simultaneously
<?php define("ENCKEY", "w+2#)1FP&LIPTL2<8I2"); class CRYPT { public function encrypt($Str,$Key=ENCKEY) { srand(); $Str=str_pad($Str, 32-strlen($Str)); $IVSize=mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC); $IV=mcrypt_create_iv($IVSize, MCRYPT_RAND); $CryptStr=mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $Key, $Str, MCRYPT_MODE_CBC, $IV); return base64_encode($IV.$CryptStr); } public function decrypt($CryptStr,$Key=ENCKEY) { if ($CryptStr!='') { $IV=substr(base64_decode($CryptStr),0,16); $CryptStr=substr(base64_decode($CryptStr),16); return trim(mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $Key, $CryptStr, MCRYPT_MODE_CBC,$IV)); } else { return ''; } } } // class ENCRYPT() $s = "FGykgbMFQiTpVIRhO9HWL%2FwXYevfsd7ozE99pbDWge%2F2Fs8fQb1iqeaw3yAe%2BkLsmTgPUz7mo%2FsTfEsvEfldWEx9XU51gsM6T1othRV6rshB9ThE3BOOUKKnhqt%2FgYyUP6POu5HSr7Rem7TIJIEAPh4w1cTQNN2ZCXyYS4Y%2BC%2F8%3D"; $enc = new CRYPT; echo $enc->decrypt($s);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UYr2W
function name:  (null)
number of ops:  13
compiled vars:  !0 = $s, !1 = $enc
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'define'
          1        SEND_VAL                                                 'ENCKEY'
          2        SEND_VAL                                                 'w%2B2%23%291FP%26LIPTL2%3C8I2'
          3        DO_ICALL                                                 
   26     4        ASSIGN                                                   !0, 'FGykgbMFQiTpVIRhO9HWL%252FwXYevfsd7ozE99pbDWge%252F2Fs8fQb1iqeaw3yAe%252BkLsmTgPUz7mo%252FsTfEsvEfldWEx9XU51gsM6T1othRV6rshB9ThE3BOOUKKnhqt%252FgYyUP6POu5HSr7Rem7TIJIEAPh4w1cTQNN2ZCXyYS4Y%252BC%252F8%253D'
   27     5        NEW                                              $4      'CRYPT'
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !1, $4
   29     8        INIT_METHOD_CALL                                         !1, 'decrypt'
          9        SEND_VAR_EX                                              !0
         10        DO_FCALL                                      0  $7      
         11        ECHO                                                     $7
         12      > RETURN                                                   1

Class CRYPT:
Function encrypt:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UYr2W
function name:  encrypt
number of ops:  40
compiled vars:  !0 = $Str, !1 = $Key, !2 = $IVSize, !3 = $IV, !4 = $CryptStr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      <const ast>
    6     2        INIT_FCALL                                               'srand'
          3        DO_ICALL                                                 
    7     4        INIT_FCALL                                               'str_pad'
          5        SEND_VAR                                                 !0
          6        STRLEN                                           ~6      !0
          7        SUB                                              ~7      32, ~6
          8        SEND_VAL                                                 ~7
          9        DO_ICALL                                         $8      
         10        ASSIGN                                                   !0, $8
    8    11        INIT_FCALL_BY_NAME                                       'mcrypt_get_iv_size'
         12        FETCH_CONSTANT                                   ~10     'MCRYPT_RIJNDAEL_128'
         13        SEND_VAL_EX                                              ~10
         14        FETCH_CONSTANT                                   ~11     'MCRYPT_MODE_CBC'
         15        SEND_VAL_EX                                              ~11
         16        DO_FCALL                                      0  $12     
         17        ASSIGN                                                   !2, $12
    9    18        INIT_FCALL_BY_NAME                                       'mcrypt_create_iv'
         19        SEND_VAR_EX                                              !2
         20        FETCH_CONSTANT                                   ~14     'MCRYPT_RAND'
         21        SEND_VAL_EX                                              ~14
         22        DO_FCALL                                      0  $15     
         23        ASSIGN                                                   !3, $15
   10    24        INIT_FCALL_BY_NAME                                       'mcrypt_encrypt'
         25        FETCH_CONSTANT                                   ~17     'MCRYPT_RIJNDAEL_128'
         26        SEND_VAL_EX                                              ~17
         27        SEND_VAR_EX                                              !1
         28        SEND_VAR_EX                                              !0
         29        FETCH_CONSTANT                                   ~18     'MCRYPT_MODE_CBC'
         30        SEND_VAL_EX                                              ~18
         31        SEND_VAR_EX                                              !3
         32        DO_FCALL                                      0  $19     
         33        ASSIGN                                                   !4, $19
   11    34        INIT_FCALL                                               'base64_encode'
         35        CONCAT                                           ~21     !3, !4
         36        SEND_VAL                                                 ~21
         37        DO_ICALL                                         $22     
         38      > RETURN                                                   $22
   12    39*     > RETURN                                                   null

End of function encrypt

Function decrypt:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 35
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 35
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UYr2W
function name:  decrypt
number of ops:  37
compiled vars:  !0 = $CryptStr, !1 = $Key, !2 = $IV
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      <const ast>
   15     2        IS_NOT_EQUAL                                             !0, ''
          3      > JMPZ                                                     ~3, ->35
   16     4    >   INIT_FCALL                                               'substr'
          5        INIT_FCALL                                               'base64_decode'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $4      
          8        SEND_VAR                                                 $4
          9        SEND_VAL                                                 0
         10        SEND_VAL                                                 16
         11        DO_ICALL                                         $5      
         12        ASSIGN                                                   !2, $5
   17    13        INIT_FCALL                                               'substr'
         14        INIT_FCALL                                               'base64_decode'
         15        SEND_VAR                                                 !0
         16        DO_ICALL                                         $7      
         17        SEND_VAR                                                 $7
         18        SEND_VAL                                                 16
         19        DO_ICALL                                         $8      
         20        ASSIGN                                                   !0, $8
   18    21        INIT_FCALL                                               'trim'
         22        INIT_FCALL_BY_NAME                                       'mcrypt_decrypt'
         23        FETCH_CONSTANT                                   ~10     'MCRYPT_RIJNDAEL_128'
         24        SEND_VAL_EX                                              ~10
         25        SEND_VAR_EX                                              !1
         26        SEND_VAR_EX                                              !0
         27        FETCH_CONSTANT                                   ~11     'MCRYPT_MODE_CBC'
         28        SEND_VAL_EX                                              ~11
         29        SEND_VAR_EX                                              !2
         30        DO_FCALL                                      0  $12     
         31        SEND_VAR                                                 $12
         32        DO_ICALL                                         $13     
         33      > RETURN                                                   $13
         34*       JMP                                                      ->36
   20    35    > > RETURN                                                   ''
   22    36*     > RETURN                                                   null

End of function decrypt

End of class CRYPT.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.44 ms | 1396 KiB | 27 Q