Decrypt String Using PHP

Posted Under: PHP, Snippets on Aug 18, 2018
Decrypt String Using PHP
PHP snippet to decrypt AES-256 encrypted string with 32 Bytes key. In order to use decryption php_mcrypt extension need to be installed and activated.
$encryptionKey="EncryptionKeyMustBExactly32Bytes";// 32 bytes Key
$encryptedBytes= base64_decode($base64EncodedData);
echo mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $encryptionKey, $encryptedBytes, MCRYPT_MODE_CBC, $initializationVector);
Sample output
My Very special secret message