PHP code example of mjohann / simple-aes-256

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;

simple-aes-256/
├── src/
│   └── SimpleAES256.php
│   └── Facades/
│       └── SimpleAES256.php
├── example/
│   └── script.php
├── composer.json
├── .gitignore
├── LICENSE
└── README.md