3v4l.org

run code in 300+ PHP versions simultaneously
<?php function encrypt($texttocrypt, $ky, $iv) { // $ky = '5rrdv4lkjdshfkl43bgd'; // Key from file // $iv = ; try { $encrypted = ""; $length = strlen($texttocrypt); $cipher = mcrypt_module_open(MCRYPT_RIJNDAEL_256, '', MCRYPT_MODE_CBC, ''); mcrypt_generic_init($cipher, $ky, $iv); $encrypted = base64_encode(mcrypt_generic($cipher, $texttocrypt)); mcrypt_generic_deinit($cipher); $result1 = bin2hex($iv); $result2 = bin2hex($encrypted); $result = $result1 . $result2; return $result; } catch (Exception $e) { $this->lastError = "Error while encrypting '".$texttocrypt."' - ".$e->getMessage(); throw new Exception($this->lastError); } } echo encrypt('sup#own#hnf#15', 'jhfjdjj%6s77w', '234ghyjdGtskjd&7d6sj6w6hfkjhvfDw20');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NIqJH
function name:  (null)
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   INIT_FCALL                                               'encrypt'
          1        SEND_VAL                                                 'sup%23own%23hnf%2315'
          2        SEND_VAL                                                 'jhfjdjj%256s77w'
          3        SEND_VAL                                                 '234ghyjdGtskjd%267d6sj6w6hfkjhvfDw20'
          4        DO_FCALL                                      0  $0      
          5        ECHO                                                     $0
          6      > RETURN                                                   1

Function encrypt:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 43
Branch analysis from position: 43
2 jumps found. (Code = 107) Position 1 = 44, Position 2 = -2
Branch analysis from position: 44
1 jumps found. (Code = 108) Position 1 = -2
filename:       /in/NIqJH
function name:  encrypt
number of ops:  60
compiled vars:  !0 = $texttocrypt, !1 = $ky, !2 = $iv, !3 = $encrypted, !4 = $length, !5 = $cipher, !6 = $result1, !7 = $result2, !8 = $result, !9 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
    8     3        ASSIGN                                                   !3, ''
    9     4        STRLEN                                           ~11     !0
          5        ASSIGN                                                   !4, ~11
   11     6        INIT_FCALL_BY_NAME                                       'mcrypt_module_open'
          7        FETCH_CONSTANT                                   ~13     'MCRYPT_RIJNDAEL_256'
          8        SEND_VAL_EX                                              ~13
          9        SEND_VAL_EX                                              ''
         10        FETCH_CONSTANT                                   ~14     'MCRYPT_MODE_CBC'
         11        SEND_VAL_EX                                              ~14
         12        SEND_VAL_EX                                              ''
         13        DO_FCALL                                      0  $15     
         14        ASSIGN                                                   !5, $15
   12    15        INIT_FCALL_BY_NAME                                       'mcrypt_generic_init'
         16        SEND_VAR_EX                                              !5
         17        SEND_VAR_EX                                              !1
         18        SEND_VAR_EX                                              !2
         19        DO_FCALL                                      0          
   13    20        INIT_FCALL                                               'base64_encode'
         21        INIT_FCALL_BY_NAME                                       'mcrypt_generic'
         22        SEND_VAR_EX                                              !5
         23        SEND_VAR_EX                                              !0
         24        DO_FCALL                                      0  $18     
         25        SEND_VAR                                                 $18
         26        DO_ICALL                                         $19     
         27        ASSIGN                                                   !3, $19
   14    28        INIT_FCALL_BY_NAME                                       'mcrypt_generic_deinit'
         29        SEND_VAR_EX                                              !5
         30        DO_FCALL                                      0          
   15    31        INIT_FCALL                                               'bin2hex'
         32        SEND_VAR                                                 !2
         33        DO_ICALL                                         $22     
         34        ASSIGN                                                   !6, $22
   16    35        INIT_FCALL                                               'bin2hex'
         36        SEND_VAR                                                 !3
         37        DO_ICALL                                         $24     
         38        ASSIGN                                                   !7, $24
   17    39        CONCAT                                           ~26     !6, !7
         40        ASSIGN                                                   !8, ~26
   18    41      > RETURN                                                   !8
         42*       JMP                                                      ->59
   19    43  E > > CATCH                                       last         'Exception'
   20    44    >   FETCH_THIS                                       $28     
         45        CONCAT                                           ~30     'Error+while+encrypting+%27', !0
         46        CONCAT                                           ~31     ~30, '%27+-+'
         47        INIT_METHOD_CALL                                         !9, 'getMessage'
         48        DO_FCALL                                      0  $32     
         49        CONCAT                                           ~33     ~31, $32
         50        ASSIGN_OBJ                                               $28, 'lastError'
         51        OP_DATA                                                  ~33
   21    52        NEW                                              $34     'Exception'
         53        CHECK_FUNC_ARG                                           
         54        FETCH_THIS                                       $35     
         55        FETCH_OBJ_FUNC_ARG                               $36     $35, 'lastError'
         56        SEND_FUNC_ARG                                            $36
         57        DO_FCALL                                      0          
         58      > THROW                                         0          $34
   23    59*     > RETURN                                                   null

End of function encrypt

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
182.03 ms | 1403 KiB | 18 Q