## Some instructions on the usage of the accompanying python files for the cracking of encrypted texts.
python3 with libraries: 'numpy' and 'unidecode'
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.
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