-
PHP DES加解密类支持openssl方式兼容
资源介绍
<?php
$data = [
'name' => 'Tom',
'age' => 20,
'sex' => 'm',
'contry' => '英国'
];
//php 7.1以下
require_once "Des.php";
$des = Des::share('key', 'asdfglkj'); //
$encrypt = $des->encrypt(json_encode($data));
echo 'DES加密后:'.$encrypt.'
'; $decrypt = $des->decrypt($encrypt); echo 'DES解密后:'.$decrypt.'
'; //openssl 方式兼容上方 require_once "Des71.php"; $des = Des71::share('key', 'asdfglkj'); //asdfglkj $encrypt = $des->encrypt(json_encode($data)); echo 'DES加密后:'.$encrypt.'
'; $decrypt = $des->decrypt($encrypt); echo 'DES解密后:'.$decrypt.'
';
'; $decrypt = $des->decrypt($encrypt); echo 'DES解密后:'.$decrypt.'
'; //openssl 方式兼容上方 require_once "Des71.php"; $des = Des71::share('key', 'asdfglkj'); //asdfglkj $encrypt = $des->encrypt(json_encode($data)); echo 'DES加密后:'.$encrypt.'
'; $decrypt = $des->decrypt($encrypt); echo 'DES解密后:'.$decrypt.'
';
- 上一篇: aes128_pkcs7_base64
- 下一篇: SM4密码算法