CONDI trick

To decode a CONDI cipher you need its key and starting shift. This post demonstrates a trick for decoding the cipher without knowing the starting shift. I'll illustrate the trick with a specific example:

Here's our example keyed alphabet with key word CRYPTOGRAM

1 2 3 4 5 6 7 8 9 10 11 12 13

C R Y P T O G A M B D E F

14 15 16 17 18 19 20 21 22 23 24 25 26

H I J K L N Q S U V W X Z

Here's a short CONDI cipher encoded with this key: RZYZ OIUCQF. To decode it we need the starting shift, or equivalently, the first plaintext letter. (If you know the first plaintext letter you can find the starting shift and vice versa). Say the starting letter is 'l'.

RZYZ OIUCQF

l--- ------

Recall that to find the plaintext letter after 'l', you take the position of 'l' in the key, (position=18), find the position of the next ciphertext letter Z (position = 26), and subtract to get the position of the next plaintext letter (26-18 = 8), so the next plaintext letter is 'a' at key position 8.

RZYZ OIUCQF

la-- ------

Now here's the trick: To decode the cipher, given the key, it's enough to know any plaintext letter, even if it's not the first one. Suppose we only know the first letter of the second word:

RZYZ OIUCQF

---- c-----

We can decode the remainder of the second word, and any subsequent ciphertext, in the same way as we decode if we had been given the first plaintext letter. But the letters to the left of a known plaintext letter can be decoded just as easily! We know that the key position x of the plaintext letter to the left of 'c' in the above example, when subtracted, mod 26, from the position of the ciphertext letter O (position=6), will give the position of 'c' (position=1). So 6-x = 1. Hence x equals 5, and the letter to the left of 'c' is the letter in key position 5, namely 't'.

We can continue decoding from right-to-left in the same way, getting:

RZYZ OIUCQF

last c-----

This trick is especially useful for computer solvers because it eliminates the need for any "starting shift" variable in your solving program -- provided the cipher comes with a crib even if the crib is only one letter! The program can take a trial key, find the first crib letter, and decode from right-to-left to get the part of the trial decrypt before the first crib letter, and then decode left-to-right from the first crib letter to the end of the cipher. No starting shift required!