Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/usr/bin/python
import base64
a = "fx1uagMGQQMWOWhyFBxnBUdzN35NPWYHUBQHRmozeEY="
pw = "My_S3cr3t_P@$$W0rD\0"
out = ""
msg = base64.b64decode(a)
print len(msg)
print len(pw)
for cindex in range(0,len(msg)):
print "XORing index %d with key index %d" % (cindex,cindex % len(pw))
out += chr(ord(msg[cindex]) ^ ord(pw[cindex % len(pw)]))
for cindex in range(18,len(msg)):
for i in range(0,len(pw)):
OUTCHAR = chr(ord(msg[cindex]) ^ ord(pw[i]))
if OUTCHAR in "0123456789abcdef":
print "[%d]: xor with index %d:%c" % (cindex,i,OUTCHAR)
print out
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.