PHP code example of shaozeming / crypt

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

    

shaozeming / crypt example snippets


// config/crypt.php

   
    /**
     * 本项目的app_secret
     */
    'app_secret' =>'12345678912345678912345678912312',

    /**
     * 加密规则,支持AES-128-CBC,AES-256-CBC
     */
    'cipher' => 'AES-256-CBC',


use ShaoZeMing\Crypt\CryptService;

$config = 'test'=>123];
$sign = $obj->sign($data);   //签名
print_r($sign);
$check = $obj->signCheck($data,$sign);   //延签
print_r($check);

$payload =  $obj->encrypt($data);  //加密
print_r($payload);
$data = $obj->decrypt($payload);   //解密
print_r($data);