3v4l.org

run code in 500+ PHP versions simultaneously
<?php $key = hex2bin('000102030405060708090a0b0c0d0e0f'); $message = hex2bin('5061726101676f6e000300'); $iv = mcrypt_create_iv(16, MCRYPT_DEV_URANDOM); $encrypted = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, $message, MCRYPT_MODE_CBC, $iv); $decrypted = mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $key, $encrypted, MCRYPT_MODE_CBC, $iv); // This should still be padded: var_dump(bin2hex($decrypted)); // Let's strip off the padding: $stripped = rtrim($decrypted, "\0"); var_dump(bin2hex($stripped)); // Does this equal the original message? var_dump($stripped === $message);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fAt72
function name:  (null)
number of ops:  56
compiled vars:  !0 = $key, !1 = $message, !2 = $iv, !3 = $encrypted, !4 = $decrypted, !5 = $stripped
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                                   'hex2bin'
          1        SEND_VAL                                                     '000102030405060708090a0b0c0d0e0f'
          2        DO_ICALL                                             $6      
          3        ASSIGN                                                       !0, $6
    4     4        INIT_FCALL                                                   'hex2bin'
          5        SEND_VAL                                                     '5061726101676f6e000300'
          6        DO_ICALL                                             $8      
          7        ASSIGN                                                       !1, $8
    5     8        INIT_FCALL_BY_NAME                                           'mcrypt_create_iv'
          9        SEND_VAL_EX                                                  16
         10        FETCH_CONSTANT                                       ~10     'MCRYPT_DEV_URANDOM'
         11        SEND_VAL_EX                                                  ~10
         12        DO_FCALL                                          0  $11     
         13        ASSIGN                                                       !2, $11
    6    14        INIT_FCALL_BY_NAME                                           'mcrypt_encrypt'
         15        FETCH_CONSTANT                                       ~13     'MCRYPT_RIJNDAEL_128'
         16        SEND_VAL_EX                                                  ~13
         17        SEND_VAR_EX                                                  !0
         18        SEND_VAR_EX                                                  !1
         19        FETCH_CONSTANT                                       ~14     'MCRYPT_MODE_CBC'
         20        SEND_VAL_EX                                                  ~14
         21        SEND_VAR_EX                                                  !2
         22        DO_FCALL                                          0  $15     
         23        ASSIGN                                                       !3, $15
    7    24        INIT_FCALL_BY_NAME                                           'mcrypt_decrypt'
         25        FETCH_CONSTANT                                       ~17     'MCRYPT_RIJNDAEL_128'
         26        SEND_VAL_EX                                                  ~17
         27        SEND_VAR_EX                                                  !0
         28        SEND_VAR_EX                                                  !3
         29        FETCH_CONSTANT                                       ~18     'MCRYPT_MODE_CBC'
         30        SEND_VAL_EX                                                  ~18
         31        SEND_VAR_EX                                                  !2
         32        DO_FCALL                                          0  $19     
         33        ASSIGN                                                       !4, $19
   10    34        INIT_FCALL                                                   'var_dump'
         35        INIT_FCALL                                                   'bin2hex'
         36        SEND_VAR                                                     !4
         37        DO_ICALL                                             $21     
         38        SEND_VAR                                                     $21
         39        DO_ICALL                                                     
   13    40        INIT_FCALL                                                   'rtrim'
         41        SEND_VAR                                                     !4
         42        SEND_VAL                                                     '%00'
         43        DO_ICALL                                             $23     
         44        ASSIGN                                                       !5, $23
   14    45        INIT_FCALL                                                   'var_dump'
         46        INIT_FCALL                                                   'bin2hex'
         47        SEND_VAR                                                     !5
         48        DO_ICALL                                             $25     
         49        SEND_VAR                                                     $25
         50        DO_ICALL                                                     
   17    51        INIT_FCALL                                                   'var_dump'
         52        IS_IDENTICAL                                         ~27     !5, !1
         53        SEND_VAL                                                     ~27
         54        DO_ICALL                                                     
         55      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
171.63 ms | 3007 KiB | 17 Q