3v4l.org

run code in 300+ PHP versions simultaneously
<?php function my_simple_crypt( $string, $action = 'e' ) { // you may change these values to your own $secret_key = 'my_simple_secret_key'; $secret_iv = 'my_simple_secret_iv'; $output = false; $encrypt_method = "AES-256-CBC"; $key = hash( 'sha256', $secret_key ); $iv = substr( hash( 'sha256', $secret_iv ), 0, 16 ); if( $action == 'e' ) { $output = base64_encode( openssl_encrypt( $string, $encrypt_method, $key, 0, $iv ) ); } else if( $action == 'd' ){ $output = openssl_decrypt( base64_decode( $string ), $encrypt_method, $key, 0, $iv ); } return $output; } $encrypted = my_simple_crypt( '10000', 'e' ); echo $encrypted; $decrypted = my_simple_crypt( 'RTlOMytOZStXdjdHbDZtamNDWFpGdz09', 'd' );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5bSiS
function name:  (null)
number of ops:  12
compiled vars:  !0 = $encrypted, !1 = $decrypted
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   INIT_FCALL                                               'my_simple_crypt'
          1        SEND_VAL                                                 '10000'
          2        SEND_VAL                                                 'e'
          3        DO_FCALL                                      0  $2      
          4        ASSIGN                                                   !0, $2
   25     5        ECHO                                                     !0
   26     6        INIT_FCALL                                               'my_simple_crypt'
          7        SEND_VAL                                                 'RTlOMytOZStXdjdHbDZtamNDWFpGdz09'
          8        SEND_VAL                                                 'd'
          9        DO_FCALL                                      0  $4      
         10        ASSIGN                                                   !1, $4
         11      > RETURN                                                   1

Function my_simple_crypt:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 35
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 48
Branch analysis from position: 48
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 35
2 jumps found. (Code = 43) Position 1 = 37, Position 2 = 48
Branch analysis from position: 37
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 48
filename:       /in/5bSiS
function name:  my_simple_crypt
number of ops:  50
compiled vars:  !0 = $string, !1 = $action, !2 = $secret_key, !3 = $secret_iv, !4 = $output, !5 = $encrypt_method, !6 = $key, !7 = $iv
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      'e'
    5     2        ASSIGN                                                   !2, 'my_simple_secret_key'
    6     3        ASSIGN                                                   !3, 'my_simple_secret_iv'
    8     4        ASSIGN                                                   !4, <false>
    9     5        ASSIGN                                                   !5, 'AES-256-CBC'
   10     6        INIT_FCALL                                               'hash'
          7        SEND_VAL                                                 'sha256'
          8        SEND_VAR                                                 !2
          9        DO_ICALL                                         $12     
         10        ASSIGN                                                   !6, $12
   11    11        INIT_FCALL                                               'substr'
         12        INIT_FCALL                                               'hash'
         13        SEND_VAL                                                 'sha256'
         14        SEND_VAR                                                 !3
         15        DO_ICALL                                         $14     
         16        SEND_VAR                                                 $14
         17        SEND_VAL                                                 0
         18        SEND_VAL                                                 16
         19        DO_ICALL                                         $15     
         20        ASSIGN                                                   !7, $15
   13    21        IS_EQUAL                                                 !1, 'e'
         22      > JMPZ                                                     ~17, ->35
   14    23    >   INIT_FCALL                                               'base64_encode'
         24        INIT_FCALL_BY_NAME                                       'openssl_encrypt'
         25        SEND_VAR_EX                                              !0
         26        SEND_VAR_EX                                              !5
         27        SEND_VAR_EX                                              !6
         28        SEND_VAL_EX                                              0
         29        SEND_VAR_EX                                              !7
         30        DO_FCALL                                      0  $18     
         31        SEND_VAR                                                 $18
         32        DO_ICALL                                         $19     
         33        ASSIGN                                                   !4, $19
         34      > JMP                                                      ->48
   16    35    >   IS_EQUAL                                                 !1, 'd'
         36      > JMPZ                                                     ~21, ->48
   17    37    >   INIT_FCALL_BY_NAME                                       'openssl_decrypt'
         38        INIT_FCALL                                               'base64_decode'
         39        SEND_VAR                                                 !0
         40        DO_ICALL                                         $22     
         41        SEND_VAR_NO_REF_EX                                       $22
         42        SEND_VAR_EX                                              !5
         43        SEND_VAR_EX                                              !6
         44        SEND_VAL_EX                                              0
         45        SEND_VAR_EX                                              !7
         46        DO_FCALL                                      0  $23     
         47        ASSIGN                                                   !4, $23
   20    48    > > RETURN                                                   !4
   21    49*     > RETURN                                                   null

End of function my_simple_crypt

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
200.02 ms | 1403 KiB | 23 Q