3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $hash = md5('test'); $s =encrypt_blowfish('123123123123', $hash); decrypt_blowfish($s, $hash); function decrypt_blowfish($data, $key) { $iv = pack("H*", substr($data, 0, 16)); $x = pack("H*", substr($data, 16)); while (strlen($iv) < mcrypt_get_iv_size(MCRYPT_BLOWFISH, MCRYPT_MODE_CBC)) { $iv .= "\0"; } $res = mcrypt_decrypt(MCRYPT_BLOWFISH, $key, $x, MCRYPT_MODE_CBC, $iv); return $res; } function encrypt_blowfish($data, $key) { $iv_size = mcrypt_get_iv_size(MCRYPT_BLOWFISH, MCRYPT_MODE_CBC); $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); $crypttext = mcrypt_encrypt(MCRYPT_BLOWFISH, $key, $data, MCRYPT_MODE_CBC, $iv); return bin2hex($iv . $crypttext); }
Output for 7.0.6 - 7.2.0
Fatal error: Uncaught Error: Call to undefined function mcrypt_get_iv_size() in /in/2dfI1:17 Stack trace: #0 /in/2dfI1(3): encrypt_blowfish('123123123123', '098f6bcd4621d37...') #1 {main} thrown in /in/2dfI1 on line 17
Process exited with code 255.
Output for 5.4.2 - 5.5.34, 5.6.7 - 5.6.20, 7.0.0 - 7.0.5
Output for 5.3.18 - 5.3.29, 5.5.35, 5.6.21 - 5.6.28
Fatal error: Call to undefined function mcrypt_get_iv_size() in /in/2dfI1 on line 17
Process exited with code 255.