3v4l.org

run code in 300+ PHP versions simultaneously
<?php $dec = Decrypt("wpdPVWejqNRYqDTeUJ2Iw06/rnfHAoy5jtgTojiilD0=", "ICS2015", "7"); echo "Dec: " . $dec . "\r\n"; $enc = Encrypt("boy10@naver.com", "ICS2015", "7"); echo "Enc: " . $enc . "\r\n"; function Decrypt($ciphertext, $password, $salt) { $ciphertext = base64_decode($ciphertext); $key = PBKDF1($password, $salt, 100, 32); $iv = PBKDF1($password, $salt, 100, 16); // NB: Need 128 not 256 and CBC mode to be compatible $decpad = mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $key, $ciphertext, MCRYPT_MODE_CBC, $iv); $pad = ord($decpad[($len = strlen($decpad)) - 1]); $dec = substr($decpad, 0, strlen($decpad) - $pad); return $dec; } function Encrypt($ciphertext, $password, $salt) { $key = PBKDF1($password, $salt, 100, 32); $iv = PBKDF1($password, $salt, 100, 16); return base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, $ciphertext, MCRYPT_MODE_CBC, $iv)); } function PBKDF1($pass,$salt,$count,$dklen) { $t = $pass.$salt; //echo 'S||P: '.bin2hex($t).'<br/>'; $t = sha1($t, true); //echo 'T1:' . bin2hex($t) . '<br/>'; for($i=2; $i <= $count; $i++) { $t = sha1($t, true); //echo 'T'.$i.':' . bin2hex($t) . '<br/>'; } $t = substr($t,0,$dklen); return $t; } ?>
Output for 7.0.6 - 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
Fatal error: Uncaught Error: Call to undefined function mcrypt_decrypt() in /in/OtNgt:19 Stack trace: #0 /in/OtNgt(3): Decrypt('\xC2\x97OUg\xA3\xA8\xD4X\xA84\xDEP\x9D\x88...', 'ICS2015', '7') #1 {main} thrown in /in/OtNgt on line 19
Process exited with code 255.
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 Fatal error: Uncaught Error: Call to undefined function mcrypt_decrypt() in /in/OtNgt:19 Stack trace: #0 /in/OtNgt(3): Decrypt('\xC2\x97OUg\xA3\xA8\xD4X\xA84\xDEP\x9D\x88...', 'ICS2015', '7') #1 {main} thrown in /in/OtNgt on line 19
Process exited with code 255.
Output for 5.6.0 - 5.6.20, 7.0.0 - 7.0.5
Warning: mcrypt_decrypt(): Key of size 20 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/OtNgt on line 19 Dec: Warning: mcrypt_encrypt(): Key of size 20 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in /in/OtNgt on line 37 Enc:
Output for 5.5.35 - 5.5.37, 5.6.21 - 5.6.28
Fatal error: Call to undefined function mcrypt_decrypt() in /in/OtNgt on line 19
Process exited with code 255.
Output for 5.5.0 - 5.5.34
Dec: Enc: 2qJj8OqQ2NHvk89smORngA==

preferences:
202.78 ms | 401 KiB | 266 Q