shaozeming/crypt

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

v1.0.1 2019-07-18 02:02 UTC

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-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