Advertisement
Niko454

Untitled

Apr 19th, 2015
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. $textToEncrypt = "My super secret information.";
  2. $encryptionMethod = "AES-256-CBC"; // AES is used by the U.S. gov't to encrypt top secret documents.
  3. $secretHash = "25c6c7ff35b9979b151f2136cd13b0ff";
  4.  
  5. //To encrypt
  6. $encryptedMessage = openssl_encrypt($textToEncrypt, $encryptionMethod, $secretHash);
  7.  
  8. //To Decrypt
  9. $decryptedMessage = openssl_decrypt($encryptedMessage, $encryptionMethod, $secretHash);
  10.  
  11. //Result
  12. echo "Encrypted: $encryptedMessage <br>Decrypted: $decryptedMessage";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement