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; var temp, i : integer; ch : char; begin temp :=0; For i := 1 To Length(S) do begin 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.