//加密
var data = '世界你好';
var key = CryptoJS.enc.Utf8.parse('dvyYRQlnPRCMdQSe');
var iv = CryptoJS.enc.Utf8.parse('face0123456789ai');
var a = CryptoJS.AES.encrypt(data, key, {iv:iv,mode:CryptoJS.mode.CBC}).toString();
console.log(a);
//解密
var ikey = CryptoJS.enc.Utf8.parse('dvyYRQlnPRCMdQSe');
var iiv = CryptoJS.enc.Utf8.parse('face0123456789ai');
var pwd = a;
var b = CryptoJS.AES.decrypt(pwd, ikey, {iv:iiv,mode:CryptoJS.mode.CBC}).toString(CryptoJS.enc.Utf8);
console.log(b);
需要引入aes.js,和pad-zeropadding-min.js
https://diyibailingyici.chuangdangjianghudewumingyouxia.cn/zy/js/aes.js
https://diyibailingyici.chuangdangjianghudewumingyouxia.cn/zy/js/pad-zeropadding-min.js