import hashlib
import json
import time
import urllib
M = "d569546b86c252:db:9bc7e99c5d71e5"
N = "557251g796:g54:f:ee94g8fg969e2de"
def P(t):
result = ""
for char in t:
# 对每个字符进行解码,然后减1,再进行编码
new_char = chr(ord(char) - 1)
result += new_char
return result
def web_rid(t):
n = P(M) + P(N)
r = []
indices = [
46,
47,
18,
2,
53,
8,
23,
32,
15,
50,
10,
31,
58,
3,
45,
35,
27,
43,
5,
49,
33,
9,
42,
19,
29,
28,
14,
39,
12,
38,
41,
13,
37,
48,
7,
16,
24,
55,
40,
61,
26,
17,
0,
1,
60,
51,
30,
4,
22,
25,
54,
21,
56,
59,
6,
63,
57,
62,
11,
36,
20,
34,
44,
52,
]
for index in indices:
if index < len(n):
char = n[index]
r.append(char)
mixin_key = "".join(r)
# 获取当前时间戳
u = int(time.time())
# 构建查询字符串
s = json.dumps(t, sort_keys=True)
f = urllib.parse.quote(s)
# 拼接并加密w_rid
y = f + mixin_key
w_rid = hashlib.md5(y.encode("utf-8")).hexdigest()
return {"w_rid": w_rid, "wts": str(u)}
print(web_rid({"mid": 1, "web_location": 2}))