From 95341b61b030c9e1290f3b326cb7ec584f543aea Mon Sep 17 00:00:00 2001 From: Reiner Herrmann Date: Sun, 31 Aug 2014 20:21:45 +0200 Subject: moved files to higher directory after split to new repository --- 059.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 059.py (limited to '059.py') diff --git a/059.py b/059.py new file mode 100644 index 0000000..449afb7 --- /dev/null +++ b/059.py @@ -0,0 +1,28 @@ +import string + +keys = [] + +for a in string.lowercase: + for b in string.lowercase: + for c in string.lowercase: + keys.append(a+b+c) + +f = open('059.txt', 'r') +content = f.read().split(',') +f.close() + +cipher = [ int(i) for i in content ] +cipher_len = len(cipher) + +for key in keys: + decoded = "" + for p in range(0, cipher_len): + decoded += chr(cipher[p] ^ ord(key[p%3])) + if decoded.find(" the ") != -1 and decoded.find(" and ") != -1: + break + +#print decoded +#print key + +print sum([ ord(x) for x in decoded ]) + -- cgit v1.2.3