Monday, October 14, 2013

Code 13 : Route Cipher

A Route Cipher is very similar to a Rail Fence cipher with one exception. You still write the message vertically in columns, but instead of reading off the secret message horizontally, you read it off using a predetermined pattern. For example, lets use a spiral pattern for this one:
The last J is just a random letter to fill in the space. If we are using a clockwise spiral to read off the message, then it becomes:
A more complex pattern could be, "every other letter going backwards to the front and then every other letter going forwards to the end again", which would give you a secret message of:
The complex pattern makes this algorithm difficult to decipher unless you know the key.

The Route Cipher is a transposition cipher where the key is which route to follow when reading the ciphertext from the block created with the plaintext. The plaintext is written in a grid, and then read off following the route chosen
First we write the plaintext in a block of reasonable size for the plaintext. Part of your key is the size of this grid, so you need to decide on either a number of columns or number of rows in the grid before starting. Once the plaintext is written out in the grid, you use the Route assigned. This could be spiralling inwards from the top right corner in a clockwise direction, or zigzagging up and down.
As an example, lets encrypt the plaintext "abort the mission, you have been spotted". First we need to decide on the number of columns we are going to use, lets say 5.
The plaintext written in a grid with 5 columns.
Notice how we have used nulls at the end of the message to make a nice rectangle.
We then choose which route we want to use to encrypt the message.
With a route of reading down the columns we get the ciphertext: "ATSYV NTBHS OESEO EIUBP DRMOH EOXTI NAETX".
With a route of spiralling inwards counter-clockwise from the bottom right we get: "XTEAN ITROB ATSYV NTEDX OEHOM EHSOE SPBUI".
To decrypt a message received that has been encoded with the Route Cipher, we need to know the route used and the width or height of the grid. We then start by constructing a blank grid of the right size, and then place the ciphertext letters in the grid following the route specified.
For example, to decrypt the ciphertext "RAEWE CREDX ESIDO V" with the route spiral inwards counter-clockwise from the top right, with a grid width of 4, we follow the process shown below
We start by drawing a grid that is 4x4, since the width is 4, and there are 16 characters in the ciphertext.
We at the top right square, and begin to spiral inwards in a counter-clockwise direction.
Continue in the spiralling direction until the whole ciphertext is placed in the grid.
Now, reading off the plaintext we get "We are discovered".

The Route Cipher is easy to use to jumble up a message very quickly. It has some problems depending on what route you pick as you can end up with large chunks of plaintext in the right order within the ciphertext (or simply reversed) which gives away alot about the width of the grid and the route used. Careful selection of the route is important.
However, for a suitably lengthy message, there are potentially infinitely many different routes that could be taken through the grid. It is limited only by imagination and ease of communication of the route.
An historical use of the Route Cipher was the Union Route Cipher used by the Union forces during the American Civil War. Rather than transposing letters by the given route, it moved whole words around. Some words, of vital importance were not protected in this way, so they were first encoded using a codeword. Sometimes, the cipher clerks would even add whole null words to the ciphertext, often making the message humorous.


Post a Comment

Note: Only a member of this blog may post a comment.