Skip to content

Instantly share code, notes, and snippets.

@aziza-kasenova
Last active December 30, 2022 16:15
Show Gist options
  • Save aziza-kasenova/0cc029f74c03b7a19868ac4f8052a10a to your computer and use it in GitHub Desktop.
Save aziza-kasenova/0cc029f74c03b7a19868ac4f8052a10a to your computer and use it in GitHub Desktop.
<?php
$plainText = 'Hello, World!';
echo "This is an original: {$plainText}\n";
$key= "my32digitkey12345678901234567890";
$iv = "my16digitIvKey12";
$encrypted = openssl_encrypt(
$plainText,
'AES-256-CBC',
$key,
0,
$iv
);
echo "This is an encrypted: {$encrypted}\n";
$decrypted = openssl_decrypt(
$encrypted,
'AES-256-CBC',
$key,
0,
$iv
);
echo "This is a decrypted: {$decrypted}\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment