moth/puzzles/crypto/160xor.py

17 lines
479 B
Python
Raw Normal View History

2009-10-13 10:08:03 -06:00
#!/usr/bin/python3
2009-10-13 16:08:11 -06:00
import crypto
2009-10-13 10:08:03 -06:00
2009-10-13 16:08:11 -06:00
alice = b'''Do you think they'll try another frequency count? It might be better if they just looked for patterns.'''
bob = b'''You'd be amazed at how often this is used in lieu of real crypto. It's about as effective as a ceasar cypher. chronic failure'''
2009-10-13 10:08:03 -06:00
2009-10-13 16:08:11 -06:00
key = 0xac
def encode(text):
out = bytearray()
for t in text:
out.append(t ^ key)
return bytes(out)
crypto.mkIndex(encode, encode, alice, bob, crypto.hexFormat)