3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $key_arr = array(0x09, 0x76, 0x28, 0x34, 0x3f, 0xe9, 0x9e, 0x23, 0x76, 0x5c, 0x15, 0x13, 0xac, 0xcf, 0x8b, 0x02); $iv_arr = array(0x56, 0x2e, 0x17, 0x99, 0x6d, 0x09, 0x3d, 0x28, 0xdd, 0xb3, 0xba, 0x69, 0x5a, 0x2e, 0x6f, 0x58); $key = implode(array_map("chr", $key_arr)); $iv = implode(array_map("chr", $iv_arr)); $encryptedMessage = openssl_encrypt("openssl: hello", 'AES-128-CBC', $key, OPENSSL_RAW_DATA, $iv); $decryptedMessage = mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $key, $encryptedMessage, MCRYPT_MODE_CBC, $iv); echo $decryptedMessage; echo "\n"; $encryptedMessage = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, "mcrypt: hello", MCRYPT_MODE_CBC, $iv); $decryptedMessage = openssl_decrypt($encryptedMessage, 'AES-128-CBC', $key, OPENSSL_RAW_DATA|OPENSSL_ZERO_PADDING, $iv); echo $decryptedMessage;
based on Ip8qN
Output for 7.1.20, 7.2.6
Fatal error: Uncaught Error: Call to undefined function openssl_encrypt() in /in/8utiv:6 Stack trace: #0 {main} thrown in /in/8utiv on line 6
Process exited with code 255.
Output for 7.0.0 - 7.1.15, 7.2.0 - 7.2.3
Fatal error: Uncaught Error: Call to undefined function mcrypt_decrypt() in /in/8utiv:7 Stack trace: #0 {main} thrown in /in/8utiv on line 7
Process exited with code 255.
Output for hhvm-3.18.5 - 3.22.0
openssl: hello mcrypt: hello
Output for 5.6.0 - 5.6.30
Fatal error: Call to undefined function mcrypt_decrypt() in /in/8utiv on line 7
Process exited with code 255.