3v4l.org

run code in 300+ PHP versions simultaneously
<?php function encrypt($string, $salt = NULL){ $mcrypt_iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_ECB); $mcrypt_iv = mcrypt_create_iv($mcrypt_iv_size, MCRYPT_URAND); $mcrypted = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $salt, $string, MCRYPT_MODE_ECB, $mcrypt_iv); $encoded = base64_encode($mcrypted); return $encoded; } function decrypt($hash, $salt = NULL){ $mcrypt_iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_ECB); $mcrypt_iv = mcrypt_create_iv($mcrypt_iv_size, MCRYPT_RAND); $basedecoded = base64_decode($hash); $mcrypted = mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $salt, $basedecoded, MCRYPT_MODE_ECB, $mcrypt_iv); return $mcrypted; } echo encrypt('to jest testowy string');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qUPtG
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E >   INIT_FCALL                                               'encrypt'
          1        SEND_VAL                                                 'to+jest+testowy+string'
          2        DO_FCALL                                      0  $0      
          3        ECHO                                                     $0
          4      > RETURN                                                   1

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

End of function encrypt

Function decrypt:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qUPtG
function name:  decrypt
number of ops:  31
compiled vars:  !0 = $hash, !1 = $salt, !2 = $mcrypt_iv_size, !3 = $mcrypt_iv, !4 = $basedecoded, !5 = $mcrypted
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      null
   17     2        INIT_FCALL_BY_NAME                                       'mcrypt_get_iv_size'
          3        FETCH_CONSTANT                                   ~6      'MCRYPT_RIJNDAEL_128'
          4        SEND_VAL_EX                                              ~6
          5        FETCH_CONSTANT                                   ~7      'MCRYPT_MODE_ECB'
          6        SEND_VAL_EX                                              ~7
          7        DO_FCALL                                      0  $8      
          8        ASSIGN                                                   !2, $8
   18     9        INIT_FCALL_BY_NAME                                       'mcrypt_create_iv'
         10        SEND_VAR_EX                                              !2
         11        FETCH_CONSTANT                                   ~10     'MCRYPT_RAND'
         12        SEND_VAL_EX                                              ~10
         13        DO_FCALL                                      0  $11     
         14        ASSIGN                                                   !3, $11
   20    15        INIT_FCALL                                               'base64_decode'
         16        SEND_VAR                                                 !0
         17        DO_ICALL                                         $13     
         18        ASSIGN                                                   !4, $13
   22    19        INIT_FCALL_BY_NAME                                       'mcrypt_decrypt'
         20        FETCH_CONSTANT                                   ~15     'MCRYPT_RIJNDAEL_128'
         21        SEND_VAL_EX                                              ~15
         22        SEND_VAR_EX                                              !1
         23        SEND_VAR_EX                                              !4
         24        FETCH_CONSTANT                                   ~16     'MCRYPT_MODE_ECB'
         25        SEND_VAL_EX                                              ~16
         26        SEND_VAR_EX                                              !3
         27        DO_FCALL                                      0  $17     
         28        ASSIGN                                                   !5, $17
   24    29      > RETURN                                                   !5
   25    30*     > RETURN                                                   null

End of function decrypt

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.89 ms | 1402 KiB | 18 Q