Authored by 周少峰

encreyption less 8

... ... @@ -10,12 +10,16 @@ class Encryption {
//密钥
private static $_secrect_key = 'yoho9646abcdefgh';
//前面补8位0
private static $_preString = '00000000';
/**
* 加密方法
* @param string $str
* @return string
*/
public static function encrypt($str){
$str = self::$_preString.$str;
//AES, 128 ECB模式加密数据
$screct_key = self::$_secrect_key;
$str = trim($str);
... ... @@ -38,6 +42,7 @@ class Encryption {
$encrypt_str = mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $screct_key, $str, MCRYPT_MODE_ECB, $iv);
$encrypt_str = trim($encrypt_str);
$encrypt_str = self::stripPKSC7Padding($encrypt_str);
$encrypt_str = ltrim($encrypt_str, self::$_preString);
return $encrypt_str;
}
... ...