PHP code example of thank / crypto

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

    

thank / crypto example snippets


    use thank\cryto
    
    $config = [
        'key' => 'xxxx', // 加密key
        'iv'  => 'yyyy', // 偏移量
    ];
    
    // 新建实例
    $aes = new AES($config);
    
    // 加密 参数$data为数组 $method 的默认值是:AES-256-CBC 返回值是 string
    $aes->encrypt($data, $method);
    
    // 解密 参数$string为encode后的加密串 $method 的默认值是:AES-256-CBC 返回值是 array
    $aes->eecrypt($string, $method);