|
发表于 2021-4-23 10:06:22
|
显示全部楼层
上海市上海市
- function rc4(t, e) {
- for (var n, r = [], s = 0, i = "", o = 0; o < 256; o++)
- r[o] = o;
- for (o = 0; o < 256; o++)
- s = (s + r[o] + t.charCodeAt(o % t.length)) % 256,
- n = r[o],
- r[o] = r[s],
- r[s] = n;
- o = 0,
- s = 0;
- for (var a = 0; a < e.length; a++)
- n = r[o = (o + 1) % 256],
- r[o] = r[s = (s + r[o]) % 256],
- r[s] = n,
- i += String.fromCharCode(e.charCodeAt(a) ^ r[(r[o] + r[s]) % 256]);
- return i
- }
- function encodeRequest(t) {
- return t = this.prepareToEncode(t),
- t = this.rc4(">*6@&~eTnr_FQGp}", t),
- btoa(t)
- }
- function prepareToEncode(t) {
- return unescape(encodeURIComponent(JSON.stringify(t)))
- }
- var body={login: "baiyang", password: "qiuyurun123"}
- console.log(encodeRequest(body))
复制代码 |
|