1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
| nums = [7107, 2676, 52815, 3666, 54091, 28777, 35367, 10586, 25358, 65063, 6311, 24454, 42823, 33695, 16895, 7107, 49054, 64044]
enc = [55568, 49906, 1737, 38871, 50041, 14151, 40283, 30065, 9059, 61980, 19841, 3054, 26730, 6325, 56961, 34785, 23561, 8122]
def dec(consts):
const_list = []
for i in range(0,16,4):
const_list.append(consts)
consts=consts^enc[i]^enc[i+1]^enc[i+2]^enc[i+3]
const_list.append(consts)
j = 0
for i in range(4):
consts=const_list[i]
for j in range(4*i, 4*i+4):
enc[j]=enc[j]^nums[j]
enc[j]=enc[j]^consts
enc[j]=enc[j]&0xffff
enc[16] = enc[16] ^ 0xFFFFBF9E
enc[16] = enc[16] ^ const_list[-1]
enc[16] = enc[16] & 0xffff
enc[17] = enc[17] ^ 0xFA2C
enc[17] = enc[17] ^ const_list[-1]
enc[17] = enc[17] & 0xffff
if __name__ == "__main__":
dec(0x64e2fbe3)
s = "".join(hex(i)[2:].zfill(2) for i in enc)
print(bytes.fromhex(s).decode('utf-8'))
|