3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $key="0123456789123456"; $iv = mcrypt_create_iv(16, MCRYPT_DEV_URANDOM); $plain = "id=1"; $res = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, $plain, "cbc", $iv); //$res = base64_encode($iv.$res); $res = base64_decode($iv.$res); $iv = substr($res,0, 16); $res = substr($res, 16, strlen($res)-16); $res = mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $key, $res, "cbc", $iv); $res = str_replace("\x00", "", $res); parse_str($res, $arr); var_dump($arr);
based on kdfBc
Output for 7.0.6 - 7.2.0
Fatal error: Uncaught Error: Call to undefined function mcrypt_create_iv() in /in/42BoK:3 Stack trace: #0 {main} thrown in /in/42BoK on line 3
Process exited with code 255.
Output for 5.6.10 - 5.6.11, 5.6.16, 5.6.20, 7.0.1 - 7.0.2, 7.0.5
Warning: mcrypt_decrypt(): Received initialization vector of size 3, but size 16 is required for this encryption mode in /in/42BoK on line 10 array(0) { }
Output for 5.6.18, 7.0.4
Warning: mcrypt_decrypt(): Received initialization vector of size 8, but size 16 is required for this encryption mode in /in/42BoK on line 10 array(0) { }
Output for 5.6.13, 5.6.15, 7.0.3
Warning: mcrypt_decrypt(): Received initialization vector of size 5, but size 16 is required for this encryption mode in /in/42BoK on line 10 array(0) { }
Output for 7.0.0
Warning: mcrypt_decrypt(): Received initialization vector of size 6, but size 16 is required for this encryption mode in /in/42BoK on line 10 array(0) { }
Output for 5.3.18 - 5.3.29, 5.5.35, 5.6.21 - 5.6.28
Fatal error: Call to undefined function mcrypt_create_iv() in /in/42BoK on line 3
Process exited with code 255.
Output for 5.6.8 - 5.6.9, 5.6.12, 5.6.19
Warning: mcrypt_decrypt(): Received initialization vector of size 7, but size 16 is required for this encryption mode in /in/42BoK on line 10 array(0) { }
Output for 5.6.17
Warning: mcrypt_decrypt(): Received initialization vector of size 9, but size 16 is required for this encryption mode in /in/42BoK on line 10 array(0) { }
Output for 5.6.14
Warning: mcrypt_decrypt(): Received initialization vector of size 4, but size 16 is required for this encryption mode in /in/42BoK on line 10 array(0) { }
Output for 5.4.1 - 5.5.34
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in /in/42BoK on line 10 array(1) { ["B��2�R���D�t_��"]=> string(0) "" }