# Cryptanalysis of the Straddle Checkerboard

The straddle checkerboard is a substitution cipher with variable length substitutions. As such, it is a little more difficult to break than simple substitution ciphers, however not impossible.

The key for a straddle checkerboard cipher looks like this:

0 1 2 3 4 5 6 7 8 9 f k m c p d y e 3: h b i g q r o s a z 7: l u t j n w v x

Note the positions of the blanks. There are 4 blanks, and the secret to breaking the straddle checkerboard is that if you can guess the blank positions then it turns the cipher into a simple substitution that can be cracked using normal methods. For example, if we create a ciphertext using the key above and decrypt it using the key below:

0 1 2 3 4 5 6 7 8 9 a b c d e f g h 3: i j k l m n o p q r 7: a t u v w x y z written as: abc.def.ghijklmnopqrstuvwxyz..

We will be left with just a simple substitution. Not every key will be able to decrypt every message, e.g. the example keys above cannot have 38, 39, 78 or 79 in the ciphertext. Every key will have a set of numbers that it cannot decrypt. If these numbers occur in the ciphertext, we know the key can't have been used to encipher it, so we can discard the key. It turns out that we don't need to check all the positions of the second 2 blanks, as soon as we find a set of positions for them that work we can just use it, as they all give equivalent substitution ciphers. Only the positions of the first 2 blanks matter.

Since there must be 2 blanks in the first 10 characters of the key we have 10 choose 2 = 45 ways to put the blanks into an arbitrary key e.g.

..abcdefghijklmnopqrstuvwxyz.. .a.bcdefghijklmnopqrstuvwxyz.. .ab.cdefghijklmnopqrstuvwxyz.. etc.

Once we have generated all the 45 possible ways of putting blanks into a key, we have to use them to decrypt our message e.g. `690974672309938377275387070360723094383772709387
2638757438333832743772974928387272384175943874720383270`. After decrypting with each of these 45 keys, one of the decryptions will be a substitution cipher that is our real text, the rest are junk. The couple of times I've done this with different straddle checkerboard ciphers, the correct one has always been the shortest of the remaining candidates, but it is probably wise to try breaking all 45 as substitution ciphers to see which one decrypts to the correct plaintext. Alternatively you could rank the candidates using something like the Index of Coincidence, the best IC should match the correct plaintext.

## Python Code §

Below is some python code that takes a straddle checkerboard cipher in the variable 'ctext' and prints the candidate substitution ciphers ranked by IC.

comments powered by Disqus