shaozeming / crypt
明文传输:数据签名/验签、密文传输:数据加/解密
Installs: 6 770
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: >=7.1.3
- ext-json: *
- ext-mbstring: *
- ext-openssl: *
Requires (Dev)
- mockery/mockery: ^0.9.9
- phpunit/phpunit: ^6.3
This package is auto-updated.
Last update: 2024-11-18 14:08:12 UTC
README
Installing
$ composer require shaozeming/crypt -v
configuration
// config/crypt.php /** * 本项目的app_secret */ 'app_secret' =>'12345678912345678912345678912312', /** * 加密规则,支持AES-128-CBC,AES-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