Update: There is a more secure version available. Details
<?php
$plaintext = 'My secret message 1234';Update: There is a more secure version available. Details
<?php
$plaintext = 'My secret message 1234';| <?php | |
| // 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); | |
| // Generate an initialization vector | |
| // This *MUST* be available for decryption as well |
| using System; | |
| using System.IO; | |
| using System.Security.Cryptography; | |
| using System.Text; | |
| class AES | |
| { | |
| public static string Encrypt(string plainText, string keyString) | |
| { | |
| byte[] cipherData; |