In the previous article, I review a brief history of ancient Cryptography and Steganography. In this article, we will explain more detail about the different techniques of cryptography.
Cryptography methods can generally be divided into two types of Transposition and substitution. In transposition, the letters of the message are rearranged and produce the secret. This method is not secure for encrypting short messages such as one word, because the possibilities or rearranging a word are limited and it will be very easy to guess the message from the secret. Let’s look at an example. Imagine we have “big” as our message. The possibilities for encrypting it using simple transposition are as follow gib, gbi, big, bgi, ibg, igb. So guessing the secret is fairly easy. However, if the number of letters slightly increase it leads to a dramatic incline the number of possibilities which makes it very hard and impossible to guess the secret. Now let’s say you have a sentence with 15 letters, the possibilities will be: 1307674368000 . If you add one more letter and make it 16 letters you will have 20922789888000 possibilities. The formula for calculation of possibilities of a combination of letters is Factorial. 16!=20922789888000. It appears that using a random transposition of letters in longer sentences provides a very secure method of encryption. However this method has a big drawback, randomly encrypting the message makes it impossible also for the intended target to decrypt the message.
Therefore the best way to use transposition is to use a specific system for moving letters around. This system should be shared between the sender of secret and the recipient but it should be kept secret from enemies. One of the simplest methods of transposition is Rail Fence. In rail fence letters of message alternatively, get divided into two lines then they will join with their next. The lower line will be attached to the end of the upper line to complete the encryption. For a better understanding look at the following example:
Our message is: I Love To Learn Cryptography
The recipient can simply recover the message by reversing the process. You can make the Rail Fence more complex by dividing the message to more than two rows. Even for more complexity, we can switch the place of a pair of letters from one row to another row!