登录 注册
当前位置:主页 > 资源下载 > 10 > PHP DES加解密类支持openssl方式兼容

PHP DES加解密类支持openssl方式兼容

  • 更新:2024-12-16 22:00:08
  • 大小:4KB
  • 推荐:★★★★★
  • 来源:网友上传分享
  • 类别:PHP - 后端
  • 格式:ZIP

资源介绍

<?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.'
';