3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php 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() $enc = new CRYPT; $s = "txowsgg2pkktlq9t3itjfqxinqgciw92|~|1|~|188.172.219.43"; $s = $enc->encrypt($s, "w+2#)1FP&LIPTL2<8I2"); //$s = "DXU+BnC/xV6b/CQXj2kd+qyRIw9esCuFb8vQuyJkPFQzyYLu7NXKIpRlrWsOe5xLhvCwpRcXcr8dpsK9zOYlSgxUSgoPlLcrlsD1+RJNCm2bDB0RJw8lg4P47nCThpnd3XsgHpcwfU4lp/OfmAWFHikFOKOOa3iWGL7vQPsDax0="; $test = $enc->encrypt($s, "w+2#)1FP&LIPTL2<8I2"); //echo $test; $lol = $enc->decrypt($s, "w+2#)1FP&LIPTL2<8I2"); echo $enc->decrypt($lol, "w+2#)1FP&LIPTL2<8I2");
based on XTm1H
Output for 7.0.6 - 7.2.0
Fatal error: Uncaught Error: Call to undefined function mcrypt_get_iv_size() in /in/MQUK7:7 Stack trace: #0 /in/MQUK7(26): CRYPT->encrypt('txowsgg2pkktlq9...', 'w+2#)1FP&LIPTL2...') #1 {main} thrown in /in/MQUK7 on line 7
Process exited with code 255.
Output for 5.6.8 - 5.6.20, 7.0.0 - 7.0.5
Warning: mcrypt_encrypt(): Key of size 19 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/MQUK7 on line 9 Warning: mcrypt_encrypt(): Key of size 19 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/MQUK7 on line 9 Warning: mcrypt_decrypt(): Key of size 19 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/MQUK7 on line 17
Output for 5.3.19 - 5.3.29, 5.5.35, 5.6.21 - 5.6.28
Fatal error: Call to undefined function mcrypt_get_iv_size() in /in/MQUK7 on line 7
Process exited with code 255.
Output for 5.4.0 - 5.5.34
�bPr68*�n���^6��p[��{B�#`