|
@@ -6,8 +6,8 @@ const iv = CryptoJS.enc.Utf8.parse('ABCDEF7563850888'); // 十六位十六进制
|
|
|
// 解密方法
|
|
// 解密方法
|
|
|
export const Decrypt = (word: string): string => {
|
|
export const Decrypt = (word: string): string => {
|
|
|
const encryptedHexStr = CryptoJS.enc.Hex.parse(word);
|
|
const encryptedHexStr = CryptoJS.enc.Hex.parse(word);
|
|
|
- const srcs = CryptoJS.enc.Base64.stringify(encryptedHexStr);
|
|
|
|
|
- const decrypt = CryptoJS.AES.decrypt(srcs, key, {
|
|
|
|
|
|
|
+ const src = CryptoJS.enc.Base64.stringify(encryptedHexStr);
|
|
|
|
|
+ const decrypt = CryptoJS.AES.decrypt(src, key, {
|
|
|
iv,
|
|
iv,
|
|
|
mode: CryptoJS.mode.CBC,
|
|
mode: CryptoJS.mode.CBC,
|
|
|
padding: CryptoJS.pad.Pkcs7,
|
|
padding: CryptoJS.pad.Pkcs7,
|
|
@@ -17,8 +17,8 @@ export const Decrypt = (word: string): string => {
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
export const Encrypt = (word: string): string => {
|
|
export const Encrypt = (word: string): string => {
|
|
|
- const srcs = CryptoJS.enc.Utf8.parse(word);
|
|
|
|
|
- const encrypted = CryptoJS.AES.encrypt(srcs, key, {
|
|
|
|
|
|
|
+ const src = CryptoJS.enc.Utf8.parse(word);
|
|
|
|
|
+ const encrypted = CryptoJS.AES.encrypt(src, key, {
|
|
|
iv,
|
|
iv,
|
|
|
mode: CryptoJS.mode.CBC,
|
|
mode: CryptoJS.mode.CBC,
|
|
|
padding: CryptoJS.pad.Pkcs7,
|
|
padding: CryptoJS.pad.Pkcs7,
|