3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Encryption { public function decrypt($string) { $output = false; $key = 'myKey';//must be same as of encryption // initialization vector $iv = md5(md5($key)); $output = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, md5($key), $string, MCRYPT_MODE_CBC, $iv); print_r($output); $output = str_replace('\0', '', addslashes(rtrim($output, ""))); return $output; } public function encrypt($string) { $output = false; $key = 'myKey'; // initialization vector $iv = md5(md5($key)); $output = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5($key), $string, MCRYPT_MODE_CBC, $iv); $output = base64_encode($output); return $output; } public function encryptData($input) { $output = trim(base64_encode(base64_encode($input)), '=='); $output = $this->encrypt($input); return $output; } public function decryptData($input) { $output = base64_decode(base64_decode($input)); $output = $this->decrypt($input); return $output; } } $test = new Encryption(); echo $test->encryptData("Narendra")."\n"; echo $test->decryptData("Narendra");
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/DG9rT
function name:  (null)
number of ops:  13
compiled vars:  !0 = $test
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   48     0  E >   NEW                                              $1      'Encryption'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   49     3        INIT_METHOD_CALL                                         !0, 'encryptData'
          4        SEND_VAL_EX                                              'Narendra'
          5        DO_FCALL                                      0  $4      
          6        CONCAT                                           ~5      $4, '%0A'
          7        ECHO                                                     ~5
   50     8        INIT_METHOD_CALL                                         !0, 'decryptData'
          9        SEND_VAL_EX                                              'Narendra'
         10        DO_FCALL                                      0  $6      
         11        ECHO                                                     $6
         12      > RETURN                                                   1

Class Encryption:
Function decrypt:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/DG9rT
function name:  decrypt
number of ops:  41
compiled vars:  !0 = $string, !1 = $output, !2 = $key, !3 = $iv
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    6     1        ASSIGN                                                   !1, <false>
    8     2        ASSIGN                                                   !2, 'myKey'
   11     3        INIT_FCALL                                               'md5'
          4        INIT_FCALL                                               'md5'
          5        SEND_VAR                                                 !2
          6        DO_ICALL                                         $6      
          7        SEND_VAR                                                 $6
          8        DO_ICALL                                         $7      
          9        ASSIGN                                                   !3, $7
   13    10        INIT_FCALL_BY_NAME                                       'mcrypt_decrypt'
         11        FETCH_CONSTANT                                   ~9      'MCRYPT_RIJNDAEL_256'
         12        SEND_VAL_EX                                              ~9
         13        INIT_FCALL                                               'md5'
         14        SEND_VAR                                                 !2
         15        DO_ICALL                                         $10     
         16        SEND_VAR_NO_REF_EX                                       $10
         17        SEND_VAR_EX                                              !0
         18        FETCH_CONSTANT                                   ~11     'MCRYPT_MODE_CBC'
         19        SEND_VAL_EX                                              ~11
         20        SEND_VAR_EX                                              !3
         21        DO_FCALL                                      0  $12     
         22        ASSIGN                                                   !1, $12
   14    23        INIT_FCALL                                               'print_r'
         24        SEND_VAR                                                 !1
         25        DO_ICALL                                                 
   15    26        INIT_FCALL                                               'str_replace'
         27        SEND_VAL                                                 '%5C0'
         28        SEND_VAL                                                 ''
         29        INIT_FCALL                                               'addslashes'
         30        INIT_FCALL                                               'rtrim'
         31        SEND_VAR                                                 !1
         32        SEND_VAL                                                 ''
         33        DO_ICALL                                         $15     
         34        SEND_VAR                                                 $15
         35        DO_ICALL                                         $16     
         36        SEND_VAR                                                 $16
         37        DO_ICALL                                         $17     
         38        ASSIGN                                                   !1, $17
   16    39      > RETURN                                                   !1
   17    40*     > RETURN                                                   null

End of function decrypt

Function encrypt:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/DG9rT
function name:  encrypt
number of ops:  29
compiled vars:  !0 = $string, !1 = $output, !2 = $key, !3 = $iv
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   RECV                                             !0      
   20     1        ASSIGN                                                   !1, <false>
   22     2        ASSIGN                                                   !2, 'myKey'
   25     3        INIT_FCALL                                               'md5'
          4        INIT_FCALL                                               'md5'
          5        SEND_VAR                                                 !2
          6        DO_ICALL                                         $6      
          7        SEND_VAR                                                 $6
          8        DO_ICALL                                         $7      
          9        ASSIGN                                                   !3, $7
   27    10        INIT_FCALL_BY_NAME                                       'mcrypt_encrypt'
         11        FETCH_CONSTANT                                   ~9      'MCRYPT_RIJNDAEL_256'
         12        SEND_VAL_EX                                              ~9
         13        INIT_FCALL                                               'md5'
         14        SEND_VAR                                                 !2
         15        DO_ICALL                                         $10     
         16        SEND_VAR_NO_REF_EX                                       $10
         17        SEND_VAR_EX                                              !0
         18        FETCH_CONSTANT                                   ~11     'MCRYPT_MODE_CBC'
         19        SEND_VAL_EX                                              ~11
         20        SEND_VAR_EX                                              !3
         21        DO_FCALL                                      0  $12     
         22        ASSIGN                                                   !1, $12
   28    23        INIT_FCALL                                               'base64_encode'
         24        SEND_VAR                                                 !1
         25        DO_ICALL                                         $14     
         26        ASSIGN                                                   !1, $14
   30    27      > RETURN                                                   !1
   31    28*     > RETURN                                                   null

End of function encrypt

Function encryptdata:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/DG9rT
function name:  encryptData
number of ops:  18
compiled vars:  !0 = $input, !1 = $output
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   33     0  E >   RECV                                             !0      
   34     1        INIT_FCALL                                               'trim'
          2        INIT_FCALL                                               'base64_encode'
          3        INIT_FCALL                                               'base64_encode'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $2      
          6        SEND_VAR                                                 $2
          7        DO_ICALL                                         $3      
          8        SEND_VAR                                                 $3
          9        SEND_VAL                                                 '%3D%3D'
         10        DO_ICALL                                         $4      
         11        ASSIGN                                                   !1, $4
   35    12        INIT_METHOD_CALL                                         'encrypt'
         13        SEND_VAR_EX                                              !0
         14        DO_FCALL                                      0  $6      
         15        ASSIGN                                                   !1, $6
   36    16      > RETURN                                                   !1
   37    17*     > RETURN                                                   null

End of function encryptdata

Function decryptdata:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/DG9rT
function name:  decryptData
number of ops:  14
compiled vars:  !0 = $input, !1 = $output
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   39     0  E >   RECV                                             !0      
   40     1        INIT_FCALL                                               'base64_decode'
          2        INIT_FCALL                                               'base64_decode'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $2      
          5        SEND_VAR                                                 $2
          6        DO_ICALL                                         $3      
          7        ASSIGN                                                   !1, $3
   41     8        INIT_METHOD_CALL                                         'decrypt'
          9        SEND_VAR_EX                                              !0
         10        DO_FCALL                                      0  $5      
         11        ASSIGN                                                   !1, $5
   42    12      > RETURN                                                   !1
   43    13*     > RETURN                                                   null

End of function decryptdata

End of class Encryption.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
174.58 ms | 1404 KiB | 29 Q