-
-
Save hugsy/f84ad968d233699bfe47b81d7b7e73dc to your computer and use it in GitHub Desktop.
flareon4 lvl2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import string | |
enc = """0d 26 49 45 2a 17 78 44 2b 6c 5d 5e 45 12 2f 17 2b 44 6f 6e 56 09 5f 45 47 73 26 0a 0d 13 17 48 42 01 40 4d 0c 02 69 00""".replace(" ", "").decode("hex") | |
def t(pos, prefix, xor_key): | |
print("pos=%d , prefix='%s' key=%d" % (pos, prefix, k)) | |
for c in range(256): | |
t = chr(c ^ xor_key) | |
if t == enc[pos]: | |
# print("Found pos=%d -> '%c'" % (pos, chr(i))) | |
return chr(c) | |
return None | |
valid = [ None for x in range(len(enc))] | |
for i in range(len(enc)-1, -1, -1): | |
k = 4 if i==len(enc)-1 else ord(valid[i+1]) | |
c = t(i, valid, k) | |
if c: | |
valid[i] = c | |
else: | |
raise Exception("error") | |
print "result", ''.join(valid) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment