3v4l.org

run code in 300+ PHP versions simultaneously
<?php $encryption_key="adfgjderuspmwzwt"; $encryptedText = "02eftQAHQKejcfMJYbm06GD21HqFCj55uhAMLqbdGEONSHWLVMn1dIchgEFCNZvCSW7oPM44qyqQ"; $key="adfgjderuspmwzwt"; $data = "02eftQAHQKejcfMJYbm06GD21HqFCj55uhAMLqbdGEONSHWLVMn1dIchgEFCNZvCSW7oPM44qyqQ"; /*$encryptionMethod = "AES-256-CBC"; // DEFINE our cipher define('AES_256_CBC', 'aes-256-cbc'); // Generate a 256-bit encryption key // This should be stored somewhere instead of recreating it each time $encryption_key = openssl_random_pseudo_bytes(32); $iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length($encryptionMethod)); $encrypted = $encryptedText . ':' . $iv; $parts = explode(':', $encrypted); $decrypted = openssl_decrypt($parts[0], $encryptionMethod, $encryption_key, 0, $parts[1]); echo "Decrypted: $decrypted\n";*/ /*function decrypt($data, $key) { $decode = base64_decode($data); return mcrypt_decrypt(MCRYPT_RIJNDAEL_128,$key,$decode,"MCRYPT_MODE_CBC","\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"); } decrypt($data, $key);*/ print("-- Start --<br />"); include("AES.class.php"); $z = $_POST['adfgjderuspmwzwt']; $data = $_POST['plaintext']; $mode = $_POST['CBC']; $iv = $_POST['1234567890abcdef']; $aes = new AES($z, $mode, $iv); $starte = microtime(true); $encrypted = $aes->encrypt($data); $ende = microtime(true); print "Execution time to encrypt: " . ($ende - $starte) . " seconds<br />"; print "Cipher-Text: " . $encrypted . "<br />"; print "Hex: " . bin2hex($encrypted) . "<br />"; print "Base 64: " . base64_encode($encrypted) . "<br /><br />"; $startd = microtime(true); $decrypted = $aes->decrypt($encryptedText); $endd = microtime(true); print "Execution time to decrypt: " . ($endd - $startd) . " seconds<br />"; print "Decrypted-Text: " . stripslashes($decrypted); print "<br />-- End --<br />";
Output for 7.1.25, 7.2.0 - 7.2.13, 7.3.0 - 7.3.1
-- Start --<br /> Warning: include(): open_basedir restriction in effect. File(AES.class.php) is not within the allowed path(s): (/tmp:/in:/etc) in /in/9mf0b on line 31 Warning: include(AES.class.php): failed to open stream: Operation not permitted in /in/9mf0b on line 31 Warning: include(): Failed opening 'AES.class.php' for inclusion (include_path='.:') in /in/9mf0b on line 31 Notice: Undefined index: adfgjderuspmwzwt in /in/9mf0b on line 32 Notice: Undefined index: plaintext in /in/9mf0b on line 33 Notice: Undefined index: CBC in /in/9mf0b on line 34 Notice: Undefined index: 1234567890abcdef in /in/9mf0b on line 35 Fatal error: Uncaught Error: Class 'AES' not found in /in/9mf0b:37 Stack trace: #0 {main} thrown in /in/9mf0b on line 37
Process exited with code 255.
Output for 7.0.0 - 7.0.27, 7.1.0 - 7.1.13
-- Start --<br /> Warning: include(AES.class.php): failed to open stream: No such file or directory in /in/9mf0b on line 31 Warning: include(): Failed opening 'AES.class.php' for inclusion (include_path='.:') in /in/9mf0b on line 31 Notice: Undefined index: adfgjderuspmwzwt in /in/9mf0b on line 32 Notice: Undefined index: plaintext in /in/9mf0b on line 33 Notice: Undefined index: CBC in /in/9mf0b on line 34 Notice: Undefined index: 1234567890abcdef in /in/9mf0b on line 35 Fatal error: Uncaught Error: Class 'AES' not found in /in/9mf0b:37 Stack trace: #0 {main} thrown in /in/9mf0b on line 37
Process exited with code 255.
Output for 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.30
-- Start --<br /> Warning: include(AES.class.php): failed to open stream: No such file or directory in /in/9mf0b on line 31 Warning: include(): Failed opening 'AES.class.php' for inclusion (include_path='.:') in /in/9mf0b on line 31 Notice: Undefined index: adfgjderuspmwzwt in /in/9mf0b on line 32 Notice: Undefined index: plaintext in /in/9mf0b on line 33 Notice: Undefined index: CBC in /in/9mf0b on line 34 Notice: Undefined index: 1234567890abcdef in /in/9mf0b on line 35 Fatal error: Class 'AES' not found in /in/9mf0b on line 37
Process exited with code 255.
Output for 5.1.0 - 5.1.6, 5.2.0 - 5.2.17
-- Start --<br /> Warning: include(AES.class.php): failed to open stream: No such file or directory in /in/9mf0b on line 31 Warning: include(): Failed opening 'AES.class.php' for inclusion (include_path='.:') in /in/9mf0b on line 31 Notice: Undefined index: adfgjderuspmwzwt in /in/9mf0b on line 32 Notice: Undefined index: plaintext in /in/9mf0b on line 33 Notice: Undefined index: CBC in /in/9mf0b on line 34 Notice: Undefined index: 1234567890abcdef in /in/9mf0b on line 35 Fatal error: Class 'AES' not found in /in/9mf0b on line 37
Process exited with code 255.
Output for 5.0.0 - 5.0.5
-- Start --<br /> Warning: main(AES.class.php): failed to open stream: No such file or directory in /in/9mf0b on line 31 Warning: main(): Failed opening 'AES.class.php' for inclusion (include_path='.:') in /in/9mf0b on line 31 Notice: Undefined index: adfgjderuspmwzwt in /in/9mf0b on line 32 Notice: Undefined index: plaintext in /in/9mf0b on line 33 Notice: Undefined index: CBC in /in/9mf0b on line 34 Notice: Undefined index: 1234567890abcdef in /in/9mf0b on line 35 Fatal error: Class 'AES' not found in /in/9mf0b on line 37
Process exited with code 255.
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.9
-- Start --<br /> Warning: main(AES.class.php): failed to open stream: No such file or directory in /in/9mf0b on line 31 Warning: main(): Failed opening 'AES.class.php' for inclusion (include_path='.:') in /in/9mf0b on line 31 Notice: Undefined index: adfgjderuspmwzwt in /in/9mf0b on line 32 Notice: Undefined index: plaintext in /in/9mf0b on line 33 Notice: Undefined index: CBC in /in/9mf0b on line 34 Notice: Undefined index: 1234567890abcdef in /in/9mf0b on line 35 Fatal error: Cannot instantiate non-existent class: aes in /in/9mf0b on line 37
Process exited with code 255.
Output for 4.3.0 - 4.3.1
-- Start --<br /> Warning: main(AES.class.php) [http://www.php.net/function.main]: failed to create stream: No such file or directory in /in/9mf0b on line 31 Warning: main() [http://www.php.net/function.main]: Failed opening 'AES.class.php' for inclusion (include_path='.:') in /in/9mf0b on line 31 Notice: Undefined index: adfgjderuspmwzwt in /in/9mf0b on line 32 Notice: Undefined index: plaintext in /in/9mf0b on line 33 Notice: Undefined index: CBC in /in/9mf0b on line 34 Notice: Undefined index: 1234567890abcdef in /in/9mf0b on line 35 Fatal error: Cannot instantiate non-existent class: aes in /in/9mf0b on line 37

preferences:
185.84 ms | 403 KiB | 261 Q