Bazeries test

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;
temp :=0;
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.

2 thoughts on “Bazeries test”

  1. That’s an interesting idea. My own neural net ID tests are pretty good on bazeries also. But I don’t know exactly how they work! To generate the neural net I run several thousand ciphers of known type and known statistics like IC, DIC, etc through the training program and the training program adjusts the weights on the neural net to try to match the types. The result is a giant matrix of several thousand weights that is beyond me to comprehend. But it seems to output pretty good answers.

Leave a Reply

Your email address will not be published. Required fields are marked *