得到密文和密钥
import base64
from ctypes import c_uint32
import libnum
DELTA = 0x9E3779B9
def decrypt(v, n, k):
rounds = 6 + int(52 / n)
sum = c_uint32(rounds * DELTA)
y = v[0].value
while rounds > 0:
e = (sum.value >> 2) & 3
p = n - 1
while p > 0:
z = v[p - 1].value
v[p].value -= (((z >> 5 ^ y << 2) + (y >> 3 ^ z << 4)) ^ ((sum.value ^ y) + (k[(p & 3) ^ e] ^ z)))
y = v[p].value
p -= 1
z = v[n - 1].value
v[0].value -= (((z >> 5 ^ y << 2) + (y >> 3 ^ z << 4)) ^ ((sum.value ^ y) + (k[(p & 3) ^ e] ^ z)))
y = v[0].value
sum.value -= DELTA
rounds -= 1
enc = "vlgg9nNjUcYuWzBSSOwKxbMD2rhFgf4zuiyMpLxpNkM="
key = "ABvWW7hqwNvHUhfP"
enc = base64.b64decode(enc.encode())
print(enc)
e = list(map(lambda i: c_uint32(int(enc[i:i + len(enc) // 8][::-1].hex(), 16)), range(0, len(enc), len(enc) // 8)))
print(e)
k = list(map(lambda i: int(key[i:i + len(key) // 4].encode()[::-1].hex(), 16), range(0, len(key), len(key) // 4)))
print(k)
decrypt(e, len(e), k)
print(b''.join(map(lambda x: libnum.n2s(x.value)[::-1], e)))