## Introduction on Types of Cipher

In the word of digital fraud, to prevent our data, many techniques are used to keep our data safe from hackers or any third party. In this article, we are going to discuss the types of cipher. Before that, lets first see the meaning. Plain text is the message or data that can be readable by the sender, receiver or any third party. When the plain text is modified by using some algorithms or techniques, the resulting data or message is called ciphertext. In short, converting plain text, i.e. readable text, into non-readable text is called ciphertext.

### Types of Cipher

Several types of cipher are given as follows:

#### 1. Caesar Cipher

In Caesar cipher, the set of plain text characters is replaced by any other character, symbols or numbers. It is a very weak technique of hiding text. In Caesar’s cipher, each alphabet in the message is replaced by three places down. Let’s see one example. The plain text is EDUCBA. As a Caesar cipher, each alphabet is replaced by three-place down so that E will replace by H, D will replace by G, U will replace by X, C will replace by F, B will replace by E, and A will replace by D. So here the plain text is EDUCBA and ciphertext Is HGXFED.

Caesar cipher algorithm is as follows:

- Read each alphabet of plain text.
- Replace each alphabet with 3 places down.
- Repeat the process for all alphabet in plain text.

**A Modified Version of Caesar Cipher: **This cipher works the same as Caesar cipher; the only difference is – in Caesar cipher, each alphabet is replaced by three-place down wherein a modified version of Caesar cipher, a user decides the number to replace the alphabet, and this number will be constant. For example, EDUCBA and number for the replacement are 1, so E will replace by F, D will replace by E, U will replace by V, C will replace by D, B will replace by C, and A will replace by B. So here, the plain text is EDUCBA, and ciphertext Is FEVDCB.

A modified version of the Caesar cipher algorithm is as follows.

- Read each alphabet of plain text.
- Take the number for replacement.
- Replace each alphabet with a specified number down.
- Repeat the process for all alphabet in plain text.

#### 2. Monoalphabetic Cipher

As Caesar cipher and a modified version of Caesar cipher is easy to break, monoalphabetic cipher comes into the picture. In monoalphabetic, each alphabet in plain text can be replaced by any other alphabet except the original alphabet. That is, A can be replaced by any other alphabet from B to Z. B can be replaced by A or C to Z. C can be replaced by A, B, and D to z, etc. Mono alphabetic cipher causes difficulty to crack the message as there are random substitutions and a large number of permutation and combination are available.

#### 3. Homophonic Substitution Cipher

A homophonic substitution cipher is similar to a monoalphabetic cipher; the only difference is in monoalphabetic, we replace the alphabet with any other random alphabet except the original alphabet wherein homophonic substitution cipher, the alphabet is replaced by fixed alphabet or set of alphabet. The substitution alphabet is replaced with te fixed. For example, replace A with x, E with B, S with A, etc. or replace A with E, x or L, B with T, A, Z, etc.

4.5 (8,975 ratings)

View Course

#### 4. Polygram Substitution Cipher

In polygram substation cipher, rather than replacing each alphabet with another, the alphabets’ Block is replaced with another block of alphabets. Replace EDUCBA with XYQLAB. In this case, EDUCBA will replace with XYQLAB, but EDU can be replaced with another set of the block, let’s assume EDU will replace with LOD. In this type of ciphers, plain text replacement is done through the block by block rather than character by character.

#### 5. Polyalphabetic Substitution Cipher

Polyalphabetic Cipher is also known as Vigenere Cipher, which Leon Battista Alberti invents. In Polyalphabetic Substitution, Cipher is a method of encrypting alphabetic texts. It uses multiple substitution alphabets for encryption. Vigener square or Vigenere table is used to encrypt the text. The table contains 26 alphabets written in different rows; each alphabet is cyclically shifted to the left according to the previous alphabet, equivalent to the 26 possible Caesar Ciphers. The cipher uses a different alphabet from one of the rows at various points in the encryption process.

Let’s consider Original text is Educba, and the keyword is Apple. For the encryption process, E is paired with A, the first letter of the original text, E, is paired with A, the first letter of the key. So use row E and column A of the Vigenère square, which is E. Similarly, for the second letter of the original text, the second letter of the key is used, the letter at row d and column p is s. The rest of the original text is enciphered in the same way. The final encryption of Educba is Esjnfa.

#### 6. Playfair Cipher

Playfair cipher is also called Playfair square. It is a cryptographic technique that is used o encrypt the data. The Playfair cipher process is as follows:

- Creation and population of the matrix.
- Encryption process.

Let’s discussed the above-mentioned steps in detail manner creation and population of the matrix. It uses a 5 * 5 matrix to store the keyword or the key, which is used for the encryption and decryption process.

This step is working as follows.

- Enter the keyword in the matrix in a row-wise manner, i.e. from left to right and top to bottom.
- Skip the duplicate words in the keyword.
- Fill the remaining spaces with the rest of the alphabets (A – Z) that were not a part of the keyword.

**Note:**while doing so, combine I and J in the same cell of the table. i.e. If I or J is present in the keyword, discard both I and J while filling the remaining space encryption process.

The encryption process works as follows:

- Break the alphabets into groups (each group must contain two values). The encryption processes will be performed on these groups.
- If both alphabets in the group are the same, add x after the first alphabet.
- If both the alphabet in the group are present in the same row of the matrix, replace them with the alphabets to their immediate right, respectively. If the original group is on the right side of the row, then wrapping around to the row’s left side happens.
- If both the alphabet in the group are present in the same column, replace them with the alphabets immediate with below, respectively. If the original group is on the bottom side of the row, then wrapping around to the row’s top side happens.
- If both the alphabet in the group are not in the same row or column, replace them with the alphabets in the same row immediately but at the other pair of corners of the rectangle, which the original group defines.

#### 7. Hill Cipher

Hill cipher works on multiple alphabets at the same time. Hill cipher works as follows:

- Assign the number to each alphabet in plain text. A = 0, B= 1….z = 25
- Organize the plain text message as a matrix of numbers based on the above step in number format. The resultant matrix is called a plain text matrix.
- Multiply the plain text matrix with a randomly chosen key. Note that the key matrix must be the size of n*n where n stands for the number of rows in a plain text matrix.
- Multiply both the matrix, i.e. step 2 and step 3.
- Calculate the mod 26 value of the above matrix, i.e. matrix results in step 4.
- Now translate the numbers to alphabets i.e. 0 =A, 1 =B, etc.
- The result of step 6 becomes our ciphertext.

### Recommended Articles

This is a guide to Types of Cipher. Here we discuss the basic concept and various types of cipher, which include caesar, monoalphabetic and homophonic substitution cipher, respectively. You may also look at the following articles to learn more –