Encrypt and decrypt data for secure storage or transmission.
Source Code
// Simple encryption example with OpenSSL
$data = "Secret Data";
$method = 'AES-256-CBC';
$key = openssl_random_pseudo_bytes(32);
$iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length($method));
$encrypted = openssl_encrypt($data, $method, $key, 0, $iv);
$decrypted = openssl_decrypt($encrypted, $method, $key, 0, $iv);
echo "Encrypted: $encryptednDecrypted: $decrypted";