1. Go to this page and download the library: Download mjohann/simple-aes-256 library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
mjohann / simple-aes-256 example snippets
use MJohann\Packlib\SimpleAES256;
text = "My name is Matheus";
$encrypt = $aes->encrypt_cbc($text);
$decrypt = $aes->decrypt_cbc($encrypt);
echo "Simple AES 256 CBC", PHP_EOL;
echo "Text: ", $text, PHP_EOL;
echo "Encrypt: ", $encrypt, PHP_EOL;
echo "Decrypt: ", $decrypt, PHP_EOL, PHP_EOL;
use MJohann\Packlib\SimpleAES256;
text = "My name is Matheus";
$encrypt = $aes->encrypt_gcm($text);
$tag = $aes->get_tag();
$decrypt = $aes->decrypt_gcm($encrypt, $tag);
echo "Simple AES 256 GCM", PHP_EOL;
echo "Text: ", $text, PHP_EOL;
echo "Encrypt: ", $encrypt, PHP_EOL;
echo "Tag: ", $tag, PHP_EOL, PHP_EOL;
echo "Decrypt: ", $decrypt, PHP_EOL;