My program to identify the primer is dependent on repeated digits at the crib location. Thus it depends on knowing the crib location. The process is to increment every 5-digit primer from 1 to 99999, extend the full primer until the digits cover the crib location, then take the segment of the primer where the crib is located and call that primer2. In the preceding con, the crib is 14 letters long. I test each primer2 first for three-digit triplets and search to see if the corresponding crib letters appear as a sequence in the ct. For example, if the primer2 were 19692055125063, my program would first test the three 5’s. The corresponding crib letters for the 5’s triplet would be MOT for the crip “TOPOFAMOUNTAIN”. If MOT does not appear in the ct, then that primer cannot be correct. If it does, I give the primer a score of 5 points. Then I do the same with 2-digit doubles, like the 1, 6, 9 and 0. Those corresponding crib letters form digraphs. If any of those digraphs don’t appear in the ct, again the primer is rejected. If they do, 1 point is given for each such pair. Once all primers have been tested and a score given to each one that isn’t rejected, those are then ordered by score and decryption attempted with the highest-scoring primers first. The process could be extended to 4- or 5-digit groups, but the crib would have to be quite long in most cases.
In the preceding con, there was only one 4-primer group that outscored the correct group. I tested this method on the same con with a shorter crib (12 letters) without a triplet in the corresponding primer2 and the correct primer appeared in the highest-scoring 200 primers. If the crib were to occur over a sequence without many triplets or doubles, this method would not be effective. If the crib were long enough, one would not need to know its location in advance because there would probably be only one 4-primer group and crib location that would work.
The crib is “TOPOFAMOUNTAIN” located above OOOULOWTNPNIRT, or more accurately, beginning at the 39th letter of the plaintext since the ciphertext letters at that point do not relate to the crib. I wrote a program that identifies the most likely primers given the ct, a crib, and the crib placement, assuming sufficient crib length. For this example my program placed the correct primer tied for 5th most likely along with 39 other primers. As an added hint, the check number at the end is 6.
Here’s a randomly generated keyphrase cipher. My hill-climber and word search programs were enough to solve it without a crib. I’ll include a caesar-shifted crib. The punctuation was left out of the ciphertext.
SSSEHORONH AH TEOSNLR SSSEHORONH LRN RSESS FR ON ORS LENLOOOEN ON IROLR IS RES LE NEO TEEHSO ORRO O OSH ET HEF.
caesar-shifted crib: BMNHM.
Note: The key was randomly selected from a list of about 1000 keyphrases. I generated the list by looping through lines of poetry. From each line of poetry I removed the beginning words until there were 26 letters left if possible, also I tried removing words from the end until 26 letters were left, and also I tried removing words at random until 26 letters were left. This particular key makes sense and can be found with an internet search.
Making a keyphrase by removing words at random is probably not a very efficient method of proceeding. I think a problem like this is called a “knapsack” problem in the literature. Knapsack problems are like traveling salesman problems — there is no general algorithm for solving them, but some reasonably good algorithms probably exist.
My analyzer had trouble with this one, placing the correct type in 17th place. It’s a random selection from Gutenberg.org. I had to peek at the worksheet to get the type and a crib. My hillclimber did not solve it without the crib. I’m including a crib: WYCDOFOBI
Here’s one more Vigenere running key cipher. It took me a long time to solve this using the word/phrase search program and the combination interactive solver and hill-climber. I kept going back and forth between all 3 of these. The initial search turned up a pretty good phrase, which I’ll include in caesar-shifted form. But I still had to do a lot more searches with various options. The searches did turn up the short initial word, and the longer word at position 23 (relative to starting at 0). With the position 23 word in place, the hill-climber got the exact solution. I’ll include a screenshot of the word/phrase search options.
Here’s a randomly generated Vigenere Running key cipher. I was able to solve it without a crib by using a program that drags a huge list of phrases across the cipher and uses logs of digraphs to score the corresponding plaintext strings. If the log digraph score of a plaintext string is high enough then the string is parsed into individual words (and partial words at the beginning and end of the string). If the parse is successful and one of the plaintext words is long enough then the phrase and corresponding plaintext string is saved to disk.
I set the length of a plaintext word to 7 or more letters. With this setting I got 35 phrase-plaintext pairs out of about 600,000 starting phrases. I used these 35 results as a collection of cribs and was then able to get the solution with a combination interactive and hill-climbing running key solver.