crypto-js aes 加解密 封装在工具文件夹里
- 加密
const Encrypt = (data) => {
let encryptData = null;
if (Object.prototype.toString.call(data) === "[object Object]") encryptData = JSON.stringify(data);
else encryptData = data;
return CryptoJS.AES.encrypt(encryptData, " e ").toString();
};
- 解密
const Decrypt = (data) => {
return CryptoJS.AES.decrypt(data, " e ").toString(CryptoJS.enc.Utf8);
};