3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php define("ENCKEY", "w+2#)1FP&LIPTL2<8I2"); class CRYPT { public function encrypt($Str,$Key=ENCKEY) { srand(); $Str=str_pad($Str, 32-strlen($Str)); $IVSize=mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC); $IV=mcrypt_create_iv($IVSize, MCRYPT_RAND); $CryptStr=mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $Key, $Str, MCRYPT_MODE_CBC, $IV); return base64_encode($IV.$CryptStr); } public function decrypt($CryptStr,$Key=ENCKEY) { if ($CryptStr!='') { $IV=substr(base64_decode($CryptStr),0,16); $CryptStr=substr(base64_decode($CryptStr),16); return trim(mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $Key, $CryptStr, MCRYPT_MODE_CBC,$IV)); } else { return ''; } } } // class ENCRYPT() $s = "FGykgbMFQiTpVIRhO9HWL%2FwXYevfsd7ozE99pbDWge%2F2Fs8fQb1iqeaw3yAe%2BkLsmTgPUz7mo%2FsTfEsvEfldWEx9XU51gsM6T1othRV6rshB9ThE3BOOUKKnhqt%2FgYyUP6POu5HSr7Rem7TIJIEAPh4w1cTQNN2ZCXyYS4Y%2BC%2F8%3D"; $enc = new CRYPT; echo $enc->decrypt($s);
based on VWk8h
Output for 7.0.6 - 7.2.0
Fatal error: Uncaught Error: Call to undefined function mcrypt_decrypt() in /in/UYr2W:18 Stack trace: #0 /in/UYr2W(29): CRYPT->decrypt('ap]\x87\xAF~\xC7{\xA31=\xF6\x96\xC3Z...') #1 {main} thrown in /in/UYr2W on line 18
Process exited with code 255.
Output for 5.6.8 - 5.6.20, 7.0.0 - 7.0.5
Warning: mcrypt_decrypt(): Key of size 19 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/UYr2W on line 18
Output for 5.3.19 - 5.3.29, 5.5.35, 5.6.21 - 5.6.28
Fatal error: Call to undefined function mcrypt_decrypt() in /in/UYr2W on line 18
Process exited with code 255.
Output for 5.4.0 - 5.5.34
#�bL,��:S��t�9��W�S�U"�q��|8ڜX���i܊��kK�#�]�f��"���ih�͛��� �#��z�O��j�%GT���[p�b�u�w�������=�h��rs��V ś �