3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?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));
based on 1XAGa
Finding entry points
Branch analysis from position: 0
Jump found. (Code = 62) Position 1 = -2
filename:       /in/8e4J0
function name:  (null)
number of ops:  33
compiled vars:  !0 = $key, !1 = $ciphertextA, !2 = $xor, !3 = $ciphertextB
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   4     0  E >   NOP                                                      
  15     1        NOP                                                      
  26     2        INIT_FCALL                                               'str_repeat'
         3        SEND_VAL                                                 '3.14'
         4        SEND_VAL                                                 4
         5        DO_ICALL                                         $4      
         6        ASSIGN                                                   !0, $4
  28     7        INIT_FCALL                                               'insecureencryptdonotuse'
         8        SEND_VAL                                                 '0000000000000001'
         9        SEND_VAR                                                 !0
        10        DO_FCALL                                      0  $6      
        11        ASSIGN                                                   !1, $6
  29    12        INIT_FCALL                                               'str_repeat'
        13        SEND_VAL                                                 '%00'
        14        INIT_FCALL                                               'mb_strlen'
        15        SEND_VAR                                                 !1
        16        SEND_VAL                                                 '8bit'
        17        DO_ICALL                                         $8      
        18        SUB                                              ~9      $8, 1
        19        SEND_VAL                                                 ~9
        20        DO_ICALL                                         $10     
        21        CONCAT                                           ~11     $10, '%40'
        22        ASSIGN                                                   !2, ~11
  30    23        BW_XOR                                           ~13     !1, !2
        24        ASSIGN                                                   !3, ~13
  31    25        INIT_FCALL                                               'var_dump'
        26        INIT_FCALL                                               'insecuredecryptdonotuse'
        27        SEND_VAR                                                 !3
        28        SEND_VAR                                                 !0
        29        DO_FCALL                                      0  $15     
        30        SEND_VAR                                                 $15
        31        DO_ICALL                                                 
        32      > RETURN                                                   1

Function insecureencryptdonotuse:
Finding entry points
Branch analysis from position: 0
Jump found. (Code = 62) Position 1 = -2
filename:       /in/8e4J0
function name:  insecureEncryptDoNotUse
number of ops:  17
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                                               'openssl_encrypt'
         3        SEND_VAR                                                 !0
   8     4        SEND_VAL                                                 'aes-128-ctr'
         5        SEND_VAR                                                 !1
  10     6        SEND_VAL                                                 3
         7        INIT_FCALL                                               'str_repeat'
  11     8        SEND_VAL                                                 '%00'
         9        SEND_VAL                                                 16
        10        DO_ICALL                                         $2      
        11        SEND_VAR                                                 $2
        12        DO_ICALL                                         $3      
        13        VERIFY_RETURN_TYPE                                       $3
        14      > RETURN                                                   $3
  13    15*       VERIFY_RETURN_TYPE                                       
        16*     > RETURN                                                   null

End of function insecureencryptdonotuse

Function insecuredecryptdonotuse:
Finding entry points
Branch analysis from position: 0
Jump found. (Code = 62) Position 1 = -2
filename:       /in/8e4J0
function name:  insecureDecryptDoNotUse
number of ops:  17
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                                               'openssl_decrypt'
         3        SEND_VAR                                                 !0
  19     4        SEND_VAL                                                 'aes-128-ctr'
         5        SEND_VAR                                                 !1
  21     6        SEND_VAL                                                 3
         7        INIT_FCALL                                               'str_repeat'
  22     8        SEND_VAL                                                 '%00'
         9        SEND_VAL                                                 16
        10        DO_ICALL                                         $2      
        11        SEND_VAR                                                 $2
        12        DO_ICALL                                         $3      
        13        VERIFY_RETURN_TYPE                                       $3
        14      > RETURN                                                   $3
  24    15*       VERIFY_RETURN_TYPE                                       
        16*     > RETURN                                                   null

End of function insecuredecryptdonotuse

Generated using Vulcan Logic Dumper, using php 7.1.0