摘要: <?php //openssl 加密解密类 class crypto{ const KEY = 'z8QFEl7dJ3ZWryJP'. 'fIWowJJFTJQOoEJ1'. 'wYS51KHgVvJNEcQe'. 'oqUY0NMp5zmluHvz'; /** * 加密 * @param $inp 阅读全文
posted @ 2020-09-29 18:31 孤舟残月浅笑嫣然 阅读(113) 评论(0) 推荐(0) 编辑
摘要: 1.前端页面(index.php): <?php /** * 前端页面 */ session_start(); //生成随机字符串 function randomStr($max = 16){ $str = 'abcdefghijklmnopqrstuvwxyz'. '0123456789'. 'A 阅读全文
posted @ 2020-09-29 17:51 孤舟残月浅笑嫣然 阅读(724) 评论(0) 推荐(0) 编辑
摘要: 在php7.2中mcrypt已经被废弃了。用openssl代替它。 例如 public function desEncrypt($str,$key) { $iv = $key; $size = mcrypt_get_block_size ( MCRYPT_DES, MCRYPT_MODE_CBC ) 阅读全文
posted @ 2020-09-29 14:20 孤舟残月浅笑嫣然 阅读(214) 评论(0) 推荐(0) 编辑
摘要: /** * 加密 * @param $input * @param $key * @return string * @throws */ private static function encryptForDES($input, $key){ $data = openssl_encrypt($inp 阅读全文
posted @ 2020-09-29 14:15 孤舟残月浅笑嫣然 阅读(353) 评论(0) 推荐(0) 编辑