Added script to solve
authorNeil Smith <n.smith@open.ac.uk>
Tue, 9 Oct 2018 11:15:07 +0000 (12:15 +0100)
committerNeil Smith <n.smith@open.ac.uk>
Tue, 9 Oct 2018 11:15:07 +0000 (12:15 +0100)
2018/2018-challenge1.py [new file with mode: 0644]

diff --git a/2018/2018-challenge1.py b/2018/2018-challenge1.py
new file mode 100644 (file)
index 0000000..dd099a3
--- /dev/null
@@ -0,0 +1,16 @@
+import os,sys,inspect
+currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
+parentdir = os.path.dirname(currentdir)
+sys.path.insert(0,parentdir) 
+
+from cipher.caesar import *
+from support.text_prettify import *
+
+c1a = open('1a.ciphertext').read()
+c1b = open('1b.ciphertext').read()
+
+key_a, score_a = caesar_break(c1a)
+open('1a.plaintext', 'w').write(caesar_decipher(c1a, key_a))
+
+key_b, score_b = caesar_break(c1b)
+open('1b.plaintext', 'w').write(caesar_decipher(c1b, key_b))