Q查查 异步请求头算法
分析笔记
i = Promise.resolve(t); l.length; )
i = i.then(l.shift(), l.shift());
var u = function(e) {
var t = e.url.replace(e.baseURL, "")
, n = o.default.stringify(e.params || {});
n && (t += (-1 === t.indexOf("?") ? "?" : o.default.options.delimiter || "&") + n),
t = t.toLowerCase();
var i = (0,
a.default)(t, e.data)
, l = (0,
r.default)(t, e.data, (0,
s.default)());
e.headers[i] = l
};
var s = function() {
var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}
, t = (arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "/").toLowerCase()
, n = JSON.stringify(e).toLowerCase();
return (0,
o.default)(t + n, (0,
a.default)(t)).toLowerCase().substr(8, 20)
};
var r = function() {
for (var e = (arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "/").toLowerCase(), t = e + e, n = "", i = 0; i < t.length; ++i) {
var a = t[i].charCodeAt() % o.default.n;
n += o.default.codes[a]
}
return n
};
{
"n": 20,
"codes": {
"0": "W",
"1": "l",
"2": "k",
"3": "B",
"4": "Q",
"5": "g",
"6": "f",
"7": "i",
"8": "i",
"9": "r",
"10": "v",
"11": "6",
"12": "A",
"13": "K",
"14": "N",
"15": "k",
"16": "4",
"17": "L",
"18": "1",
"19": "8"
}
}
iLAgikvkiBl4Bi6kkLNlgvk6BgWklriLLv8rriLv8rrvLv8vrvLv86ALv8NrLv8NvLv8rv6Lv8A6Lv8NALv8KvLv8NKLv86NLv8NkLv86KLv8NLLv8kiLv8rvALv8NNLv8kvLv8k6Lv86kLv8krLv8K6Lv8KALv8rr4Lv8riviLAgikvkiBl4Bi6kkLNlgvk6BgWklriLLv8rriLv8rrvLv8vrvLv86ALv8NrLv8NvLv8rv6Lv8A6Lv8NALv8KvLv8NKLv86NLv8NkLv86KLv8NLLv8kiLv8rvALv8NNLv8kvLv8k6Lv86kLv8krLv8K6Lv8KALv8rr4Lv8riv
_createHmacHelper: function(t) {
return function(e, n) {
return new h.HMAC.init(t,n).finalize(e)
}
}
python 代码
import hashlib
import hmac
arrcode = ["W","l","k","B","Q","g","f","i","i","r","v","6","A","K","N","k","4","L","1","8"]
In = '/api/sns/getglossaryinfo?ids=109%2c110%2c112%2c212%2c34%2c61%2c62%2c123%2c43%2c64%2c52%2c65%2c36%2c67%2c35%2c69%2c70%2c124%2c66%2c72%2c73%2c37%2c71%2c53%2c54%2c118%2c102/api/sns/getglossaryinfo?ids=109%2c110%2c112%2c212%2c34%2c61%2c62%2c123%2c43%2c64%2c52%2c65%2c36%2c67%2c35%2c69%2c70%2c124%2c66%2c72%2c73%2c37%2c71%2c53%2c54%2c118%2c102'
str = ''.join(arrcode[ord(In[i])%20] for i in range(len(In)))
msg = b'/api/sns/getglossaryinfo?ids=109%2c110%2c112%2c212%2c34%2c61%2c62%2c123%2c43%2c64%2c52%2c65%2c36%2c67%2c35%2c69%2c70%2c124%2c66%2c72%2c73%2c37%2c71%2c53%2c54%2c118%2c102{}'
str = hmac.new(str.encode("utf-8"),msg,hashlib.sha512).hexdigest()
print(str)
print(str[8:28])
#'a4fcecc68bb27d0d39ce'