Skip to content

明文传输:数据签名/验签、密文传输:数据加/解密

License

Notifications You must be signed in to change notification settings

ShaoZeMing/crypt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Translate for PHP


Installing

$ composer require shaozeming/crypt -v

configuration

// config/crypt.php

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

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

Usage

Example:

use ShaoZeMing\Crypt\CryptService;

$config = include($youerpath.'/crypt.php');

$obj = new CryptService($config);

$data = ['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);

License

MIT

About

明文传输:数据签名/验签、密文传输:数据加/解密

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages