summaryrefslogtreecommitdiff
path: root/059.py
diff options
context:
space:
mode:
Diffstat (limited to '059.py')
-rw-r--r--059.py28
1 files changed, 28 insertions, 0 deletions
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 ])
+