3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* 128-bit key = 01 23 45 67 12 34 56 78 23 45 67 89 34 56 78 9A plaintext = 01 23 45 67 89 AB CD EF ciphertext = 23 8B 4F E5 84 7E 44 B2 */ $key = "\x01\x23\x45\x67\x12\x34\x56\x78\x23\x45\x67\x89\x34\x56\x78\x9A"; $data = "\x01\x23\x45\x67\x89\xAB\xCD\xEF"; var_dump(mcrypt_encrypt('cast-128', $key, $data, 'ecb') === "\x23\x8B\x4F\xE5\x84\x7E\x44\xB2"); /* 80-bit key = 01 23 45 67 12 34 56 78 23 45 = 01 23 45 67 12 34 56 78 23 45 00 00 00 00 00 00 plaintext = 01 23 45 67 89 AB CD EF ciphertext = EB 6A 71 1A 2C 02 27 1B */ $key = "\x01\x23\x45\x67\x12\x34\x56\x78\x23\x45"; $data = "\x01\x23\x45\x67\x89\xAB\xCD\xEF"; $key .= "\x00\x00\x00\x00\x00\x00"; var_dump(mcrypt_encrypt('cast-128', $key, $data, 'ecb') === "\xEB\x6A\x71\x1A\x2C\x02\x27\x1B"); /* 40-bit key = 01 23 45 67 12 = 01 23 45 67 12 00 00 00 00 00 00 00 00 00 00 00 plaintext = 01 23 45 67 89 AB CD EF ciphertext = 7A C8 16 D1 6E 9B 30 2E */ $key = "\x01\x23\x45\x67\x12"; $data = "\x01\x23\x45\x67\x89\xAB\xCD\xEF"; $key .= "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"; var_dump(mcrypt_encrypt('cast-128', $key, $data, 'ecb') === "\x7A\xC8\x16\xD1\x6E\x9B\x30\x2E");
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7amfr
function name:  (null)
number of ops:  39
compiled vars:  !0 = $key, !1 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   ASSIGN                                                   !0, '%01%23Eg%124Vx%23Eg%894Vx%9A'
    8     1        ASSIGN                                                   !1, '%01%23Eg%89%AB%CD%EF'
   10     2        INIT_FCALL                                               'var_dump'
          3        INIT_FCALL_BY_NAME                                       'mcrypt_encrypt'
          4        SEND_VAL_EX                                              'cast-128'
          5        SEND_VAR_EX                                              !0
          6        SEND_VAR_EX                                              !1
          7        SEND_VAL_EX                                              'ecb'
          8        DO_FCALL                                      0  $4      
          9        IS_IDENTICAL                                     ~5      $4, '%23%8BO%E5%84%7ED%B2'
         10        SEND_VAL                                                 ~5
         11        DO_ICALL                                                 
   18    12        ASSIGN                                                   !0, '%01%23Eg%124Vx%23E'
   19    13        ASSIGN                                                   !1, '%01%23Eg%89%AB%CD%EF'
   20    14        ASSIGN_OP                                     8          !0, '%00%00%00%00%00%00'
   21    15        INIT_FCALL                                               'var_dump'
         16        INIT_FCALL_BY_NAME                                       'mcrypt_encrypt'
         17        SEND_VAL_EX                                              'cast-128'
         18        SEND_VAR_EX                                              !0
         19        SEND_VAR_EX                                              !1
         20        SEND_VAL_EX                                              'ecb'
         21        DO_FCALL                                      0  $10     
         22        IS_IDENTICAL                                     ~11     $10, '%EBjq%1A%2C%02%27%1B'
         23        SEND_VAL                                                 ~11
         24        DO_ICALL                                                 
   29    25        ASSIGN                                                   !0, '%01%23Eg%12'
   30    26        ASSIGN                                                   !1, '%01%23Eg%89%AB%CD%EF'
   31    27        ASSIGN_OP                                     8          !0, '%00%00%00%00%00%00%00%00%00%00%00'
   32    28        INIT_FCALL                                               'var_dump'
         29        INIT_FCALL_BY_NAME                                       'mcrypt_encrypt'
         30        SEND_VAL_EX                                              'cast-128'
         31        SEND_VAR_EX                                              !0
         32        SEND_VAR_EX                                              !1
         33        SEND_VAL_EX                                              'ecb'
         34        DO_FCALL                                      0  $16     
         35        IS_IDENTICAL                                     ~17     $16, 'z%C8%16%D1n%9B0.'
         36        SEND_VAL                                                 ~17
         37        DO_ICALL                                                 
         38      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
175.06 ms | 1452 KiB | 14 Q