name mode size
ADFGVX.txt 100644 11.59kB
ADFGVXsolution.txt 100644 1.98kB
Playfair.txt 100644 3.12kB
README.txt 100644 2.76kB
adfgvx.py 100644 6.35kB
de.txt 100644 491.07kB
en.txt 100644 940.21kB
enigma.py 100644 7.38kB
enigma.txt 100644 1.42kB
enigmasolution.txt 100644 1.62kB
fr.txt 100644 412.11kB
hillclimbing.py 100644 2.6kB
hillclimbing.tex 100644 4.57kB
nl.txt 100644 407.44kB
playfair.py 100644 3.77kB
playfairsolution.txt 100644 7.11kB
references.txt 100644 163B
runtimes.txt 100644 205B
scoring.py 100644 1.77kB
sp.txt 100644 1.33MB
texttools.py 100644 2.56kB
vigenere.py 100644 6.06kB
vigenerePlus.txt 100644 1.14kB
vigeneresolution.txt 100644 1.55kB
README.txt
## Some instructions on the usage of the accompanying python files for the cracking of encrypted texts. REQUIREMENTS python3 with libraries: 'numpy' and 'unidecode' DESCRIPTION There are 4 files to crack different encrytion methods: adfgvx, playfair, enigma and vigenere (plus column transposition). These make use of some helper files: * 'scoring' is a small collection of functions that calculate a score given a set of letters, ngrams and possibly a reference. * 'texttools' contains some funtions to parse and manipulate text strings * 'hillclimbing' contains a generic hillclimbing algorithm with simulated annealing. USAGE The executeable files adfgvx, playfair, enigma and vigenere can be run without any parameters or modification by handing them to a python interpreter. ex: 'python3 playfair.py'. A decent gain in performance can be had by using a just-in-time compiler like pypy ('pypy3 playfair.py'). These files all contain some parameters that can easily be modified to try to crack a different code, try to match a different language etc. At the beginning of the file may be some constants pertaining to the possible length of keys, some of these are finetuned to a particular code and need to be set to a wider range in order to crack a different code. (ex.: for vigenere key length is set to constant 6 to avoid local maxima) At the end of the files the input file with the code and reference text are loaded and functions to crack are called. Parameters to be changed here: * file with code: 'file = open("xxxx.txt")' -> a different txt file can be given * reference language file: 'reffile = open("xx.txt")' -> a different reference can be given, provided with the project are: nl.txt, sp.txt, de.txt, fr.txt, en.txt * temperature and #iterations: the 'hillclimb' funtion is called with two numeric parameters: * temperature is a value that can be tweaked to increase or decrease the chance that suboptimal solutions are explored, making it easier to escape local maxima, but slower to converge. * #iterations: can be decreased to make the program faster, but a result may not be found then Adfgvx and playfair should pretty much work out of the box for different codes by changing input file and language reference, and maybe tweaking temperature a little. For vigenere some more manual tweaking will be required to determine the correct key length (trying out different small ranges should work). Enigma will require the most manual work as a number of things are hardcoded here: a number of sufficiently long cycles are needed to find the different plugboard settings, and if no cycles can be found for some letters or no unique solution is found, the different possibilities will need to be checked manually.