I thought it might be useful to post some of the code I use in my Analyzer program to diagnose the type of an unknown cipher. I have a specific test for most types. The tests do not return a yes/no result, only a numerical score to indicate that type as more likely or less. Other factors like Index of Coincidence, length, Normor score, etc. also factor into the final score. Here’s the one I use for Bazeries:
Function Bazetest(S : String): Single;
temp, i : integer;
ch : char;
For i := 1 To Length(S) do
ch := S[i];
if ch in ['b', 'c', 'g', 'k', 'l', 'm', 'p'] then temp := temp + 1;
end; // i
If Length(S)>0 Then Bazetest := 100*(temp/Length(S))
Else Bazetest := 0;
End; // function Bazetest
This is written in Delphi/Pascal. Basically what it is does is to count up those ciphertext letters shown. They are not be used in the spelled-out numerical key as they do not appear in the numbers (in English). Thus most of them will be used as ciphertext substitutes for the letters in the fourth row of the plaintext polybius square, which is DIOTY. That’s the row with the highest combined frequency in the plaintext square. So the higher the number returned by this function, the more likely it is a Bazeries. It doesn’t appear in this test, but elsewhere my program also weighs heavily the absence of a J in the ciphertext, especially if all 25 other letters appear. That’s true for all the polybius square types.
I updated the interactive Grandpre solver on Bionsgadgets so it now has undo-redo buttons. Here’s a randomly generated Grandpre that I tested it on.
My “sloppy” grandpre hill-climber using the crib solved it quickly.
16 52 32 33 68 15 57 58 33 65 88 74 75 43 41 55 52 82 73 24 17 11
52 62 22 85 52 37 25 87 44 85 57 63 41 75 62 28 73 64 62 25 44 32
87 22 74 37 61 41 75 87 46 84 16 53 27 52 72 72 36 73 82 57 25 61
12 78 51 84 88 74 37 62 84 51 15 77 57 76 52 41 37 33 15 81 72 25
15 52 75 73 58 62 42 57 31 55 66 12 33 42 68 51 46 41 75 72 25 55
74 55 57 58 82 75 16 13 75 65 74 32 76 28 75 52 15 62 23 46 11 28
57 66 36 42 73 36 57 42 52 73 35 57 43 64 57 82 26 74 75 52 75 87
31 41 33 41 57 81 61 53 63 35 37 13 51 48 36 24 25 36 37 81 87 58
Thanks for providing the Grandpré worksheet at http://bionsgadgets.appspot.com/ , BION. It’s much handier to use than the interactive one I made many years ago – I’ve never put in my time to learn to program user interfaces, and in something like this it really shows! I used yours to do the JF19 AC-1217 and you made it fun rather than tedious.
I wonder whether crib placement could use more of the available frequency information. I think it currently just looks at overlaps in the crib, but perhaps it could also usefully check frequencies. I know in a homophonic like this you can’t count on high-frequency letters much, but if you have a low-frequency like ‘F’ it’s unlikely to be one of the higher-frequency dinomes. One could also give votes up and down if other digraphs or longer are formed.
I’ve also been musing about better automated Grandpré attacks, hillclimbing on both the keys and (if any) cribs, perhaps fiddling the keys to make sure it always has a full alphabet of words off my “cromulent words” lists, again paying attention to frequencies. I haven’t tried anything automatic yet – has anyone else?
I was working out the K4 keys for the Aristocrats and Patristocrats in the MA 2019 Cryptogram and wrote a K4 worksheet program to save myself some effort. You can drag the alphabet columns around to arrange them in a likely order. You can enter suspected key words and put them into the key alphabets to see if the corresponding substitutions look like they contain the other key.
A link to this program is:
Any bug fixes or suggestions for improvement are welcome.
This new format seems to be working OK, so I’ll put up another con. This one is a random unknown type from Gutenberg.org. Although grammatical in form, the last few words make no sense with the beginning and in fact are the beginning of another sentence from a different book. My program sometimes grabs a second sentence in order to meet length standards. My Analyzer identified the correct type and my hillclimber solved it quickly.
Here’s a randomly generated cipher of unknown type. All my ID tests got the correct type. Hill-climber solved it without a crib, but it took a long time. I’ll include a caesar-shifted crib.
IMQNO TAOGX DIFDE XNLKD IFLTA MOTNP MCFLP FRVGX QAAPG DRCLQ GCWRT
DFSPH CBQCG DLPYN XGNPI MQNOT AOGXD IFDEX NLKDL PYNAS NG.
caesar-shifted crib: NSLNWTSFDJFSI
Here is an unknown con from my random program.
BUGLQ JJAYQ XWSKH FFIEF VMVGJ YMSKS ZWWQP VBQBK RRHMT ZOUWJ EGRPK QAGYD JEGNT GPVVY OULRR CRLFQ ZFXRR RFIAV IH
Welcome to Recreational Cryptanalysis. It is open to any member to post comments or constructions (cons) related to recreational cryptanalysis. The site is primarily geared toward posting and solving ciphers of the types commonly published in the American Cryptogram Association (ACA) magazine The Cryptogram.
In order to be authorized to post, please fill in the contact form. You do not need to be authorized to comment on existing posts, but the comments will be moderated. Posts of cons or other crypto material should go on the Posts page (see menu above).
If you solve a con, feel free to comment about it below the posts, but do not give spoilers. You can include a keyword or continuation of a quote in Caesar cipher encrypted form to show you have solved it.