3v4l.org

run code in 300+ PHP versions simultaneously
<?php $value = 'hrace009'; $secretKey = '1dc3d24bae14ada5dd85cda425cfdcee'; function encrypt($value, $secretKey) { $method = 'AES-128-CBC'; $iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length($method)); $encrypted = openssl_encrypt($value, $method, $secretKey, 0, $iv); $ecnrypted = base64_encode($encrypted); $encrypted = strtr($encrypted,'+/=', '-_,'); $encrypted = trim($encrypted); return $ecnrypted; } function decrypt($value, $secretKey) { $method = 'AAES-128-CBC'; $extracted = explode(':', $value); return openssl_decrypt($extracted[0], $method, $secretKey, 0, $extracted[1]); } $encrypted = encrypt($value, $secretKey); echo $encrypted;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/r77r6
function name:  (null)
number of ops:  9
compiled vars:  !0 = $value, !1 = $secretKey, !2 = $encrypted
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'hrace009'
    4     1        ASSIGN                                                   !1, '1dc3d24bae14ada5dd85cda425cfdcee'
   24     2        INIT_FCALL                                               'encrypt'
          3        SEND_VAR                                                 !0
          4        SEND_VAR                                                 !1
          5        DO_FCALL                                      0  $5      
          6        ASSIGN                                                   !2, $5
   25     7        ECHO                                                     !2
          8      > RETURN                                                   1

Function encrypt:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/r77r6
function name:  encrypt
number of ops:  34
compiled vars:  !0 = $value, !1 = $secretKey, !2 = $method, !3 = $iv, !4 = $encrypted, !5 = $ecnrypted
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    8     2        ASSIGN                                                   !2, 'AES-128-CBC'
    9     3        INIT_FCALL_BY_NAME                                       'openssl_random_pseudo_bytes'
          4        INIT_FCALL_BY_NAME                                       'openssl_cipher_iv_length'
          5        SEND_VAR_EX                                              !2
          6        DO_FCALL                                      0  $7      
          7        SEND_VAR_NO_REF_EX                                       $7
          8        DO_FCALL                                      0  $8      
          9        ASSIGN                                                   !3, $8
   10    10        INIT_FCALL_BY_NAME                                       'openssl_encrypt'
         11        SEND_VAR_EX                                              !0
         12        SEND_VAR_EX                                              !2
         13        SEND_VAR_EX                                              !1
         14        SEND_VAL_EX                                              0
         15        SEND_VAR_EX                                              !3
         16        DO_FCALL                                      0  $10     
         17        ASSIGN                                                   !4, $10
   11    18        INIT_FCALL                                               'base64_encode'
         19        SEND_VAR                                                 !4
         20        DO_ICALL                                         $12     
         21        ASSIGN                                                   !5, $12
   12    22        INIT_FCALL                                               'strtr'
         23        SEND_VAR                                                 !4
         24        SEND_VAL                                                 '%2B%2F%3D'
         25        SEND_VAL                                                 '-_%2C'
         26        DO_ICALL                                         $14     
         27        ASSIGN                                                   !4, $14
   13    28        INIT_FCALL                                               'trim'
         29        SEND_VAR                                                 !4
         30        DO_ICALL                                         $16     
         31        ASSIGN                                                   !4, $16
   14    32      > RETURN                                                   !5
   15    33*     > 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/r77r6
function name:  decrypt
number of ops:  21
compiled vars:  !0 = $value, !1 = $secretKey, !2 = $method, !3 = $extracted
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   19     2        ASSIGN                                                   !2, 'AAES-128-CBC'
   20     3        INIT_FCALL                                               'explode'
          4        SEND_VAL                                                 '%3A'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $5      
          7        ASSIGN                                                   !3, $5
   21     8        INIT_FCALL_BY_NAME                                       'openssl_decrypt'
          9        CHECK_FUNC_ARG                                           
         10        FETCH_DIM_FUNC_ARG                               $7      !3, 0
         11        SEND_FUNC_ARG                                            $7
         12        SEND_VAR_EX                                              !2
         13        SEND_VAR_EX                                              !1
         14        SEND_VAL_EX                                              0
         15        CHECK_FUNC_ARG                                           
         16        FETCH_DIM_FUNC_ARG                               $8      !3, 1
         17        SEND_FUNC_ARG                                            $8
         18        DO_FCALL                                      0  $9      
         19      > RETURN                                                   $9
   22    20*     > RETURN                                                   null

End of function decrypt

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.48 ms | 1403 KiB | 22 Q