PHP code example of hashyoo / des3

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

    

hashyoo / des3 example snippets


composer 

config文件夹下创建hashyoo-des3.php
php artisan vendor:publish --provider="HashyooDes3\Providers\Des3Provider"



namespace App\Http\Controllers;

use HashyooDes3\Facade\Des3;
class IndexController extends Controller
{
    public function index()
    {
        // 加密
        $encrypt = DES3::encrypt(111);
        echo $encrypt;

        // 解密
        $decrypt = DES3::decrypt($encrypt);
        echo $decrypt;
        
        // 动态使用
        $key = 'ABCDEFGHIJKLMNOPQRSTUVWX';
        $iv =  '12345678';
        DES3::encrypt(111, $key,$iv);
        DES3::decrypt($encrypt, $key, $iv);
    }
}