Skip to content

Instantly share code, notes, and snippets.

@mikeecb
Last active August 18, 2020 22:20
Show Gist options
  • Save mikeecb/a42781567c35c6564511a3550aaabe84 to your computer and use it in GitHub Desktop.
Save mikeecb/a42781567c35c6564511a3550aaabe84 to your computer and use it in GitHub Desktop.
Cryptopals Challenge Set 1 Exercise 2
def xor(b1, b2):
b = bytearray(len(b1))
for i in range(len(b1)):
b[i] = b1[i] ^ b2[i]
return b
b1 = bytearray.fromhex("1c0111001f010100061a024b53535009181c")
b2 = bytearray.fromhex("686974207468652062756c6c277320657965")
b = bytes(xor(b1, b2))
# the kid don’t play
b.encode("hex")
# 746865206b696420646f6e277420706c6179
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment