Skip to content

Instantly share code, notes, and snippets.

@AndyNovo AndyNovo/encodehexencrypted Secret
Created Mar 6, 2019

Embed
What would you like to do?
XORient Yourself
1020222c733a203a6c393d3769362d2520353121356907160c1b0a796f06213a306f263f782e722a3b222323293628376937263c262b362a3669272c6f28292c6f2b262663203d253d21262c3763382638306f3a26246317001e78383d3b3830614546102a202c74306f36232d3d722f3f2228756c0c1a111d153817001e077e761605701d16130a6b610f060f101b7c070c001003177f32
#!/usr/bin/env python2
def xor(msg, key):
o = ''
for i in range(len(msg)):
o += chr(ord(msg[i]) ^ ord(key[i % len(key)]))
return o
with open('message', 'r') as f:
msg = ''.join(f.readlines()).rstrip('\n')
with open('key', 'r') as k:
key = ''.join(k.readlines()).rstrip('\n')
assert key.isalnum() and (len(key) == 9)
assert 'TUCTF' in msg
#NOTE: I am sharing the hex digest not the raw as indicated here
with open('encrypted', 'w') as fo:
fo.write(xor(msg, key))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.