[JavaScript] 纯文本查看 复制代码 class zn {
constructor() {
this.key = xt.enc.Base64.parse("le95G3hnFDJsBE+1/v9eYw=="),
this.iv = xt.enc.Base64.parse("IvswQFEUdKYf+d1wKpYLTg==")
}
encrypt(e) {
const t = xt.enc.Base64.parse(e);
return xt.AES.encrypt(t, this.key, {
iv: this.iv,
mode: xt.mode.CBC,
padding: xt.pad.Pkcs7
}).ciphertext.toString().toUpperCase()
}
decrypt(e) {
const t = xt.enc.Base64.parse(e)
, r = xt.enc.Base64.stringify(t);
return xt.AES.decrypt(r, this.key, {
iv: this.iv,
mode: xt.mode.CBC,
padding: xt.pad.Pkcs7
}).toString(xt.enc.Utf8).toString()
}
}
|