This commit is contained in:
2022-06-13 23:37:17 +08:00
parent d21608a860
commit 0230cb42a2
153 changed files with 62907 additions and 0 deletions

38
includes/lib/Aes.php Normal file
View File

@@ -0,0 +1,38 @@
<?php
namespace lib;
/**
* AES128加解密类
* @author dy
*
*/
class Aes
{
//密钥
private $_secrect_key;
public function __construct()
{
$this->_secrect_key = md5(SYS_KEY);
}
/**
* 加密方法
* @param string $string
* @return string
*/
public function encrypt($string)
{
return base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5($this->_secrect_key), $string, MCRYPT_MODE_CBC, md5(md5($this->_secrect_key))));
}
/**
* 解密方法
* @param string $string
* @return string
*/
public function decrypt($string)
{
return rtrim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, md5($this->_secrect_key), base64_decode($string), MCRYPT_MODE_CBC, md5(md5($this->_secrect_key))), "12");
}
}