Cipher Transposition Tool

The Cipher Transposition Tool decodes messages that have been encoded by transposing columns. The program proposes a plaintext solution for each transposition and then evaluates that solution. This evaluation is a two step process. The program first screens each solution to see if it contains one or more of the words in a keyword dictionary. Each solution that passes the screening criteria is then presented to the user who can accept it or reject it. Accepted solutions are saved to a file for further analysis. The program is written in Python. An algorithm was chosen to minimize memory usage and increase speed. The latest version of this program can be obtained from GitHub at https://github.com/JenniferPeterson333/ .

In developing this program, the most significant computational challenge was handling the very large number of possible solutions. A cipher which has n characters in each row has n factorial possible column transpositions. This means that a cipher with 17 characters per row, such as the Zodiac Z-340 cipher, has approximately 356 trillion possible solutions. The program assigns an index number to each of the columns and produces a solution for every possible permutation of those index numbers. Python provides a method called “permutations” which produces all possible permutations. Unfortunatly, all of those permutations must be stored simultaneously. Storing billions of index permutations is inefficient and in some cases may be impossible depending on the number of columns in the cipher and the amount of available memory. The Cipher Transposition Tool uses a different technique. The program generates index permutations one at a time by defining a function which uses the keyword “yield” which returns a generator object. Solutions are evaluated “on the fly” and not stored unless the user decides they are of interest.

This program has been used to attempt a solution to the last ten rows of the famous Zodiac Z-340 cipher. Two sample input files are available on GitHub. The first file, mat06-nospaces.txt, is the ciphertext matrix. This matrix was generated by taking the original ciphertext, which contains symbols, and applying symbol-to-letter substitutions. The substitutions used were those developed by Dr. Craig Bauer, professor of mathematics at York College, in his solution of the first eight rows of this same ciphertext. The second sample input file, ZodiacDictionary.txt, is a keyword dictionary. The dictionary contains words commonly used by the Zodiac killer in his messages to the police. Each proposed solution is screened to see if it contains one or more of the words in the dictionary.