PHP code example of chinawilon / aes

1. Go to this page and download the library: Download chinawilon/aes 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/ */

    

chinawilon / aes example snippets


use AES\AES;

$plain = "test中文test!!";
$key = "abc132123123123e425ab234523a45ef"; //must be hexadecimal string

$aes = new AES($key, 'aes-128-gcm');
$encrypt = $aes->encrypt($plain);
// 3vhFDoifaCXTZdA5nyZxH5ajrbGFdVFHFJhT8Qw8yVDj/UQoWONn40/NdaQ

$aes->decrypt($encrypt);
// test中文test!!