Levenshtein distance analysis
Patterns can be found in the cipher text by identifying repeated n-grams. But what about repeated sequences in which some of the characters are permitted to be different? In the 408 cipher, for example, the trigram #BV is repeated in two positions of the cipher text. But upon closer inspection, the trigrams appear within these two sequences: A9#BV and AP#BV. These two sequences differ only in their 2nd characters. The known solution of the 408 tells us that 9 and P both represent the plaintext letter "I". So, because the two 5-character sequences differ only by their 2nd characters, it is possible to infer that 9 and P represent the same letter. (Source)
We wish to determine all such partially-matching sequences, and see if they tell us anything about the 408 and 340 cipher texts.
To enumerate all such sequences, we use the Levenshtein distance as a measurement of similarity between sequences. Two strings are compared, and the Levenshtein distance is used as an error count. Errors falling within a certain threshold are considered strong "fuzzy matches" of the two strings. The table below tabulates the results of running an exhaustive search of fuzzy matches of string pairs in each cipher text. Each fuzzy match is further constrained by rejecting any matched string pairs that do not share the same beginning and end characters - this avoids including trivial cases of string matches. The table also includes counts derived from rotation and flip operations on the cipher texts.
Distance thresholds are capped to half of the string length. This avoids counting many spurious matches.
The totals are clickable, and will take you to a page that shows all of the matches (but only for the non-rotated and non-flipped cipher texts). Cells with a gray background indicate the count is at a maximum for the given cipher.
Note: When the threshold is zero, this is equivalent to searching for exact matches.
|String length||Threshold||Total (408)||Total (408 ROT90)||Total (408 FLIP)||Total (408 FLIP ROT90)||Total (340)||Total (340 ROT90)||Total (340 FLIP)||Total (340 FLIP ROT90)|
Results beyond length 12 are not included because no further matches were found.
- The count is at maximum the most for the 408 when it is not transformed via rotations and flips.
- The count is at maximum the most for the 340 when it is flipped horizontally.
- What happens to the 408-related counts if the analysis is applied to the cipher text with homophones replaced with single substitution?
- What happens to the counts when other transpositions and transformations are applied to the cipher text?