blob: 6e03336e7956a638d7e31836b91f762932846243 (
plain)
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
|
def enc(key, text):
p = 0x59
r = []
for c in text:
new = ((ord(c) ^ p) ^ key) & 0xff
r.append(new)
p = new
return r
def dec(key, text):
p = 0x59
r = []
for c in text:
new = ((c ^ key) ^ p) & 0xff
r.append(new)
p = c
return r
res = enc(0xfe, "THE WAR IS OVER AND\nWE PREVAILED.\n\nFOR NOW...\n\nYOU ARE A LEGEND!\n\nTHANKS FOR PLAYING\nTHE GAME.\0")
print ", ".join("0x%02x" % r for r in res)
res = dec(0xfe, res)
print "".join(chr(r) for r in res)
|