functionu(t) { var e = kmd5("5%^&#@*321!`~,;:" + t + "TT_APP000000';-="), //加长版时间戳利用md5生成固定长度字符串 n = parseInt(t / 1e3); e = e.split(""); // 再做处理,为了生成密钥 let i = (e = n % 2 == 0 ? e.filter(function(t, e) { return e % 2 == 0 }) : e.filter(function(t, e) { return e % 2 != 0 })).join(""); returnCryptoJS.enc.Utf8.parse(i) }
参数加密
参数t为字符串类型,请用JSON.stringify处理相关类型的数据,e为请求头中的时间戳
1 2 3 4 5 6 7
functionencryptHttp(t, e) { let n = u(e), i = CryptoJS.enc.Utf8.parse(t); returnCryptoJS.AES.encrypt(i, n, { mode: CryptoJS.mode.ECB }).toString() }
functiondecryptHttp(t, e) { let n = u(e); let i = CryptoJS.AES.decrypt(t, n, { mode: CryptoJS.mode.ECB }); returnCryptoJS.enc.Utf8.stringify(i).toString() }