import CryptoJS, {
SHA1
} from 'crypto-js'
// 17611650330 未注册
// 18810013034 失败
// 18701367882 0 审核中
/**
* tokens 加密
*
* @param {*} message
* @returns
*/
const AES_KEY = "**************"; //混淆 随便写
const AES_IV = "****************"; //混淆 随便写
//加密
export const encipherMent = (message) => {
var encrypted = CryptoJS.AES.encrypt(message, CryptoJS.enc.Utf8.parse(AES_KEY), { iv: CryptoJS.enc.Utf8.parse(AES_IV) });
console.log(encrypted)
return CryptoJS.enc.Base64.stringify(encrypted.ciphertext);
}
//解密
export const encryptDecode = (ciphertext) => {
var decrypted = CryptoJS.AES.decrypt(ciphertext, CryptoJS.enc.Utf8.parse(AES_KEY), { iv: CryptoJS.enc.Utf8.parse(AES_IV) });
return decrypted.toString(CryptoJS.enc.Utf8);
}
|