By way of twitter
Taking 2 strings of hexadecimal characters, converting hex to binary values, then xorsum the 2 values, and convert sum back to hex.
The other XOR
So the normal xor will not work on strings, so what do you do?
from binascii import hexlify, unhexlify from Crypto.Cipher import XOR # you can encounter hex strings with no spaces encrypted = '556e6e216c606f78217264627364757216' # or hex strings with spaces key = '01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01' #let's get binary representations b_encrypted = unhexlify(encrypted) b_key = unhexlify(key.replace(' ','')) # we remove the spaces #to see a binary string output, use repr: print(repr(b_key)) cosmo = XOR.new(b_key) bishop = cosmo.encrypt(b_encrypted) # yeah, encrypt to decrypt print hexlify(bishop) # the above is what was asked # the plain ascii decrypted message is print(bishop)
I think the (not really) hidden references are pretty obvious...However, even in the decrypted message, there is still a question left... :)