Instantly share code, notes, and snippets.

@mikeecb mikeecb/cryptopals_1_5.py Secret
Last active Apr 20, 2017

Embed
What would you like to do?
Cryptopals Challenge Set 1 Exercise 5
def xor(b1, b2):
b = bytearray(len(b1))
for i in range(len(b1)):
b[i] = b1[i] ^ b2[i]
return b
lines = [
"Burning 'em, if you ain't quick and nimble\n",
"I go crazy when I hear a cymbal",
]
text = "".join(lines)
key = bytearray("ICE" * len(text))
plaintext = bytes(xor(bytearray(text), key))
plaintext.encode("hex")
# 0b3637272a2b2e63622c2e69692a23693a2a3c6324202d623d63343c2a26226324272765272a282b2f20430a652e2c652a3124333a653e2b2027630c692b20283165286326302e27282f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment