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");
Output for 7.0.0 - 7.0.31, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.31, 8.2.0 - 8.2.26, 8.3.0 - 8.3.14, 8.4.1 - 8.4.2
Fatal error: Uncaught Error: Call to undefined function mcrypt_encrypt() in /in/7amfr:10 Stack trace: #0 {main} thrown in /in/7amfr on line 10
Process exited with code 255.
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.38
Fatal error: Call to undefined function mcrypt_encrypt() in /in/7amfr on line 10
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: mcrypt_encrypt() in /in/7amfr on line 10
Process exited with code 255.
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.4
Fatal error: Call to undefined function: mcrypt_encrypt() in /in/7amfr on line 10
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: mcrypt_encrypt() in /in/7amfr on line 10

preferences:
125.51 ms | 409 KiB | 5 Q