Ragbaby Tutorial


The Ragbaby Cipher uses a 24 letter alphabet as both the plain text and the cipher text. The letters I/J and W/X are combined.

The cipher alphabet is keyed to a keyword. That word provides the initial letters in the cipher alphabet with the rest of the alphabet filling out the remaining letters in the usual fashion. For example:

  Key Word: ROBIN


 Pos: 000000000011111111112222

The cipher requires that word divisions be maintained because the encipherment process for each word depends on it’s position in the message. The first letter in each word is enciphered by locating the plaintext letter in the cipher alphabet and then shifting to the right a number of places equal to the words position in the text. The remaining letters in the word are enciphered by the same process. However, the shift is increased by one place for each additional letter. For example:

PT: The early bird gets the worm.

The message is encoded as follows:

    PT:  t h e   e a r l y   b i r d   g e t s...
 Shift:  1 2 3   2 3 4 5 6   3 4 5 6   4 5 6 7
    CT:  U L H   G E N T N   A D A L   M L R R

By keeping track of the letter positions, enciphering and deciphering can be done by simple addition and subtraction. The formula is given by:

  Ct = Pt + Shift

For example, enciphering the ‘t’ (The 18th letter in the alphabet) in the first word;

  Ct = 18 + 1 = 19 = 'U'

Deciphering the first A (The 5th letter in the alphabet) in the third word:

  Pt = Ct - Shift = 5 - 3 = 2 = 'B'

Two important thing to remember about this system:

  1. The entire alphabet can be shifted as a whole either to the right or left without effecting the cipher text of a message.
  2. Pattern words do not maintain their patterns when enciphered. However, the cipher text for any word will have the same pattern no matter what shift is used to encipher them.

Cryptanalysis of the Ragbaby

The solution of this type of cipher is normally started by using the method of the probable word (In ‘The Cryptogram’, a probable word is usually supplied with the cipher). Consider the following example:

MJ03E07: Ragbaby. Ecology. (species) CERE E. US


Before using the provided crib, first notice that there are 3 words of identical length and pattern in the cryptogram. These are:

   Ct: Z Q Q      Ct: N Z Z        Ct:  S N N
Shift: 4 5 6   Shift: 9 10 11   Shift: 14 15 16

Since the pattern of these words is the same, it is tempting to say that they are 3 examples of the same word. Since the most common 3 letter word is ‘the’, lets start with this as our first guess.

Initially we start with a cipher alphabet with no know letters:

Pos: 000000000011111111112222

 Ct: ************************

Pos: 222222333333333344444444

(Notice that I have two values for the position of each letter shown. This is for ease of use during enciphering or deciphering. When enciphering, take the plain text letters value from the top position and add the shift. If the resulting value is greater than 23, find the value of the cipher text from the lower position table. When deciphering, use the values in the lower table and subtract the shift…)

Now, let’s start with the first candidate word, ‘ZQQ’. To seed the cipher alphabet, lets assume a position of the letter ‘E’ is 0 (Zero).

This provides:

Ct = Pt + shift
Ct = 0 + 6 = 'Q'.

Having determined the position of ‘Q’ = 6, we can decipher it in the same word to find the position of the letter ‘H’ since it is enciphered as the letter ‘Q’.

This provides: Ct = 6 = Pt + shift = Pt + 5. Or Pt = 1 = ‘H’.

Using the same method, we can use the other two words to determine that ‘Z’ = 11 and ‘N’ =16.

We now have:

Pos: 000000000011111111112222

 Ct: EH****Q****Z****N*******

Pos: 222222333333333344444444

Now we can work on the enciphered ‘T’ in each of these words. Since we already know the value of ‘Z’ = 11, we can use ZQQ to determine the value of ‘T’. This gives:

 Ct = 11 = Pt + shift = Pt + 4 or Pt = 11 - 4 = 7 = 'T'.

Note that if we had used the known value of N and the word NZZ we would have gotten:

Ct = 16 = Pt + shift = Pt + 9 or Pt = 16 - 9 = 7 = 'T'.  

This is very good! We have obtained the same value for ‘T’ in two different ways. Our assumption that the repeated pattern word is ‘the’ is looking very good!

We can now recover the value of ‘S’ from SSN and this provides:

Ct = Pt + shift = 7 + 14 = 21 = 'S'.

We now have:

Pos: 000000000011111111112222

 Ct: EH****QT***Z****N****S**

Pos: 222222333333333344444444

Some notes on what we have so far. E and H are adjacent in the cipher alphabet but are separated by only 2 letters in the normal alphabet. The same is true of Q and T. T and Z are separated by 3 letters in the cipher alphabet and by 4 letters (Remember W/X is a single letter) in the normal alphabet. This suggests that the letters from position 0 to position 11 are not part of the key word. This implies that F and G (Between E and H) as well as R and S (Between Q and T) are in the key word. Note that this is confirmed by the position of S in the cipher alphabet. Further note that one of the letters U, V, W/Y or Y (Between T and Z) is also in the keyword. Locating one of these letters within the keyword will locate the rest in their proper places in the gap between T and Z.

By this time, you must be getting the idea of how to solve this cipher type. Now find the position of the crib and continue the process. You will be finished before you know it!