Live Sandbox PHP openssl_encrypt() Function
PHP openssl_encrypt() Function

openssl_encrypt($your_data, $encryption_algorithm, $encryption_key, $options, $initialization_vector) - This PHP function encrypts a given data with a given encryption method and key, to return a raw or base64 encoded string.

  • $initialization_vector (IV) - an arbitary random value used as a seed, along with an encrytion key, to encrypt you message. Without a random seed, a pattern can developed in your cipher data if only your encryption key is used. By mixing in an IV, you mitigate any patterns from forming which could be identified and used to break your encryption key.

Once you have your ciper data, try using the openssl_decrypt() function to decrypt it back to its original plain text data. To use this, you will need to have the IV, cipher data, the encryption algorithm used, and the encryption key.

Your Plain Text Data:   
Encryption Algorithm:   
Encryption Key (i.e., your password):   
Suggested Reading

PHP Cookbook: Solutions & Examples

Amazon Reviewer:
Great help for someone thrown into the fray