3v4l.org

run code in 300+ PHP versions simultaneously
<?php function insecureEncryptDoNotUse(string $plaintext, string $key): string { return \openssl_encrypt( $plaintext, 'aes-128-ctr', $key, OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING, str_repeat("\x00", 16) ); } function insecureDecryptDoNotUse(string $ciphertext, string $key): string { return \openssl_decrypt( $ciphertext, 'aes-128-ctr', $key, OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING, str_repeat("\x00", 16) ); } $key = str_repeat("3.14", 4); $ciphertextA = insecureEncryptDoNotUse('0000000000000001', $key); $xor = str_repeat("\x00", mb_strlen($ciphertextA, '8bit') - 1) . "\x40"; $ciphertextB = $ciphertextA ^ $xor; var_dump(insecureDecryptDoNotUse($ciphertextB, $key));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8e4J0
function name:  (null)
number of ops:  31
compiled vars:  !0 = $key, !1 = $ciphertextA, !2 = $xor, !3 = $ciphertextB
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   INIT_FCALL                                               'str_repeat'
          1        SEND_VAL                                                 '3.14'
          2        SEND_VAL                                                 4
          3        DO_ICALL                                         $4      
          4        ASSIGN                                                   !0, $4
   28     5        INIT_FCALL                                               'insecureencryptdonotuse'
          6        SEND_VAL                                                 '0000000000000001'
          7        SEND_VAR                                                 !0
          8        DO_FCALL                                      0  $6      
          9        ASSIGN                                                   !1, $6
   29    10        INIT_FCALL                                               'str_repeat'
         11        SEND_VAL                                                 '%00'
         12        INIT_FCALL                                               'mb_strlen'
         13        SEND_VAR                                                 !1
         14        SEND_VAL                                                 '8bit'
         15        DO_ICALL                                         $8      
         16        SUB                                              ~9      $8, 1
         17        SEND_VAL                                                 ~9
         18        DO_ICALL                                         $10     
         19        CONCAT                                           ~11     $10, '%40'
         20        ASSIGN                                                   !2, ~11
   30    21        BW_XOR                                           ~13     !1, !2
         22        ASSIGN                                                   !3, ~13
   31    23        INIT_FCALL                                               'var_dump'
         24        INIT_FCALL                                               'insecuredecryptdonotuse'
         25        SEND_VAR                                                 !3
         26        SEND_VAR                                                 !0
         27        DO_FCALL                                      0  $15     
         28        SEND_VAR                                                 $15
         29        DO_ICALL                                                 
         30      > RETURN                                                   1

Function insecureencryptdonotuse:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8e4J0
function name:  insecureEncryptDoNotUse
number of ops:  20
compiled vars:  !0 = $plaintext, !1 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    6     2        INIT_FCALL_BY_NAME                                       'openssl_encrypt'
    7     3        SEND_VAR_EX                                              !0
    8     4        SEND_VAL_EX                                              'aes-128-ctr'
    7     5        SEND_VAR_EX                                              !1
   10     6        FETCH_CONSTANT                                   ~2      'OPENSSL_RAW_DATA'
          7        FETCH_CONSTANT                                   ~3      'OPENSSL_ZERO_PADDING'
          8        BW_OR                                            ~4      ~2, ~3
          9        SEND_VAL_EX                                              ~4
   11    10        INIT_FCALL                                               'str_repeat'
         11        SEND_VAL                                                 '%00'
         12        SEND_VAL                                                 16
         13        DO_ICALL                                         $5      
         14        SEND_VAR_NO_REF_EX                                       $5
    6    15        DO_FCALL                                      0  $6      
   11    16        VERIFY_RETURN_TYPE                                       $6
         17      > RETURN                                                   $6
   13    18*       VERIFY_RETURN_TYPE                                       
         19*     > RETURN                                                   null

End of function insecureencryptdonotuse

Function insecuredecryptdonotuse:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8e4J0
function name:  insecureDecryptDoNotUse
number of ops:  20
compiled vars:  !0 = $ciphertext, !1 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   17     2        INIT_FCALL_BY_NAME                                       'openssl_decrypt'
   18     3        SEND_VAR_EX                                              !0
   19     4        SEND_VAL_EX                                              'aes-128-ctr'
   18     5        SEND_VAR_EX                                              !1
   21     6        FETCH_CONSTANT                                   ~2      'OPENSSL_RAW_DATA'
          7        FETCH_CONSTANT                                   ~3      'OPENSSL_ZERO_PADDING'
          8        BW_OR                                            ~4      ~2, ~3
          9        SEND_VAL_EX                                              ~4
   22    10        INIT_FCALL                                               'str_repeat'
         11        SEND_VAL                                                 '%00'
         12        SEND_VAL                                                 16
         13        DO_ICALL                                         $5      
         14        SEND_VAR_NO_REF_EX                                       $5
   17    15        DO_FCALL                                      0  $6      
   22    16        VERIFY_RETURN_TYPE                                       $6
         17      > RETURN                                                   $6
   24    18*       VERIFY_RETURN_TYPE                                       
         19*     > RETURN                                                   null

End of function insecuredecryptdonotuse

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
172.21 ms | 1453 KiB | 18 Q