Transforming a Plain Text message to Cipher Text

There are two primary ways in which a plain text can be modified to obtain cipher text: Substitution Technique and Transposition Technique.

1. Substitution Technique:
Substitution technique involves the replacement of the letters by other letters and symbols. In a more straightforward way, the characters of plaintext are replaced, and other substitute characters, numbers and symbols are used at their place.

Types of Substitution Technique:

  1. Caesar Cipher –
    In this all characters of plain text is replaced by other characters with same pattern. For example, a replaced with D, B replaced with E.
  2. Mono Alphabetic Cipher –
    Major disadvantage of caesar cipher is that all elements are substituted with same technique, it make easy for cryptanalyst to crack it. In Mono Alphabetic Cipher, There is no relation between Substitution of characters. Therefore it makes harder for cryptanalyst to crack it. For example, a can be replaced with B-Z, B can be replaced with A, C-Z.
  3. Homophonic Substitution Cipher –
    In this technique, one plain text alphabet can map to more than one cipher text alphabet. This is the best substitution technique with maximum security. For example, a can be replaced with D and E.
  4. Polygram Substitution Cipher –
    In this rather than replacing one alphabet, block of alphabet is replaced. For example,

         Polygram Subsitution
    HELLO -------------------> YUQQW
    HELL --------------------> TEUI 
  5. Vigenere Cipher –
    This technique uses multiple character keys .Each of the keys encrypts one single character. Each character is replaced by a number (A=0, B=1, …Z=25). After all keys are used, they are recycled. For encryption, Formula used : E=(M+K)mod 26



    Plaintext:  ATTACKATDAWN
    Key:        LEMONLEMONLE
    Ciphertext: LXFOPVEFRNHR 

2. Transposition Technique:
In transposition technique, the identity of the characters remains unchanged, but their positions are changed to create the ciphertext.

Types of Transpositional Techniques:

  • Rail Fence Technique – It uses a simple algorithm:
    1. Write down plain text message as sequence of diagonals.
    2. Read the plain text written in step 1 as sequence of rows.
    Plain text: come home
    c       m        h        m
    o       e        o        e
    Cipher text : (READ ROW BY ROW) cmhmoeoe 
  • Simple Columnar Transposition Technique – It uses a simple algorithm:
    1. Write the plain text message row by row in predefined columns.
    2. Read the message column by column. It can be in any order.
    3. Message thus obtained is cipher text message.
    Plain text: come niki (suppose we have 4 columns )
    C1    C2    C3    C4
    c     o     m      e
    n     i     k      i 

    Now we can read in any order of columns. Lets read it by 3 -> 2 -> 4 ->1

    Cipher text : mkoieicn 
  • Vernam Cipher – It uses a simple algorithm:
    1. Treat each plain text character as a number in increasing sequence (A=0, B=1, …Z=25).
    2. Do the same for each character of key.
    3. Add each number corresponding to plain text alphabet and key.
    4. If sum produced greater than 26, subtract 26 form it.
    5. Translate each number of sum back to alphabet, it gives our cipher text.
    Plain text:  HOW ARE YOU
    Key :  NCBTZQARX
     H   O   W   A   R   E   Y  O  U
     7  14  22   0  17   4   24 14 20  
    +
     N   C   B   T   Z   Q   A  R  X 
     13  2   1   19  25  16  0  17 23
    ------------------------------------
     20   16  23  19  42  20  24 31  43
    
    Subtract 26 if >26: 20   16  23  19  16  20  24  5  17
    Cipher text :      U    Q   X   T    R   U   Y  F   R
    Cipher text : UQXTRUYFR 

Weakness of each technique,

In the case of Substitution:

  1. Because it’s based on the substitution of one letter with another based on a translation table. Once the translation table is known, the code is broken.
  2. Short words, words with repeated patterns, and common initial and final letters all give clues for guessing the pattern of the encryption.
  3. An encryption algorithm must be regular for it to be algorithmic and for cryptographers to be able to remember it. Unfortunately, the regularity gives clues to the cryptanalyst to break a substitution.

In the case of Transposition:

  1. Just as there are characteristic letter frequencies, there are also characteristic patterns of pairs of adjacent letters, called digrams (groups of 2 letter) and trigrams (groups of 3 letters). The frequency of appearance of letter groups can be used to match up plaintext letters that have been separated in a ciphertext.


My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.