3v4l.org

run code in 300+ PHP versions simultaneously
<?php $textToEncrypt = "Secret Text to Encrypt"; $encryptionMethod = 'aes-256-cbc'; $secretHash = "315a5504d921f8327f73a356d2bbcbf1"; // <---- you have to use some persistent. $iv_size = openssl_cipher_iv_length($encryptionMethod ); $iv = openssl_random_pseudo_bytes($iv_size); //To encrypt $encryptedMessage = openssl_encrypt($textToEncrypt, $encryptionMethod, $secretHash, 0, $iv); //Concatenate iv with data $encryptedMessageWithIv = bin2hex($iv) . $encryptedMessage; //To Decrypt $iv_size = openssl_cipher_iv_length($encryptionMethod ); $iv = hex2bin(substr($encryptedMessageWithIv, 0, $iv_size*2)); $decryptedMessage = openssl_decrypt(substr($encryptedMessageWithIv, $iv_size*2), $encryptionMethod, $secretHash, 0, $iv); echo "Encrypted: $encryptedMessageWithIv <br>Decrypted: $decryptedMessage";
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught Error: Call to undefined function openssl_cipher_iv_length() in /in/r9pYv:7 Stack trace: #0 {main} thrown in /in/r9pYv on line 7
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
45.47 ms | 401 KiB | 8 Q