Currently, the Route Cipher is usually used with a piece of paper. The letters fill the grid which has dimensions defined by the secret key.
To encrypt the message, the first step is to create a grid of one dimension determined by the secret key, and the second dimension depended on the data size. The parties must also agree which dimension (width or height) is described by the secret key, and in what way the grid will be filled with plaintext letters (row by row, or column by column). If some cells in the grid remain empty, one of two possible approaches should be taken:
- The cells may be left empty, and just ignored during all further operations.
- The sender may enter there some rare letters, and treat them as a part of the plaintext. After decryption, the receiver should be able to determine, that the letters have no sense, and that they should be ignored.
One more thing must be agreed by the sender and receiver in order to encrypt the message: an order in which the letters in the grid should be appended to ciphertext. The order should not be too simple, to prevent parts of plaintext appearing in the produced ciphertext. On the other hand, the order should not be too difficult, to prevent the need of remembering to difficult configurations by communicating parties.
The users often choose the rules that form some kind of paths on the grid, which should be follow during encryption, for example 'spiral clockwise inwards, starting from the top left corner'. The name of the cipher is derived from these paths, used for every data encryption and decryption. The way in which the path is defined is also a part of the secret key of this cipher.
As an example, let's encrypt a name of a city in Great Britain, Brighton and Hove. The secret key will be 3, and it will determine the width of the grid. We will fill the grid row by row, from left to right. Finally, we will read the grid clockwise, going inwards, and starting from the top right corner.
As usual, the encryption starts by removing the non-letter characters, and capitalizing all the letters:
The letters are then entered into the grid, which is 3-column wide:
Luckily, in our case, there is no need to add any additional characters at the bottom of the grid.
The letters are then read, and appended to the ciphertext. The reading starts from the top right, and spiral clockwise inwards. The produced encrypted text will be:
As we can see, the original text was hidden, and the ciphertext doesn't reveal any plaintext parts.
Knowing the length of the ciphertext and the secret key, the receiver is able to recreate a grid of the same size, as the one used for encryption. Then, knowing the path directions, the receiver can simple enter the letters into correct cells. Finally, the plaintext is revealed by reading the grid in the same way, as was used by the sender to enter the letters into the table.
Security of the Route Cipher
The Route Cipher provides better security than previously described the Rail Fence Cipher, due to the fact that the secret key defines not only the size of the grid but also the path. There are many possible paths, so there are a lot of available secret keys. Longer messages protected by this cipher are considered to be too difficult to break by brute force attacks, even be modern computers.
On the other hand, not all configurations provide satisfactory protection. Badly chosen keys may reveal plaintext fragments, thus making the cryptanalysis much easier.