Updated April 11, 2023

## Introduction to Types of Cipher

In the world of digital fraud, to prevent our data, many techniques are useful 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, let’s first see the meaning. Plain text is a 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 for 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 places down. So that E will be replaced by H, D will be replaced by G, U will be replaced by X, C will be replaced by F, B will be replaced by E, and A will be replaced 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 in a modified version of Caesar cipher, a user decides the number to replace the alphabet, and this number will be constant. For example, in EDUCBA, the number for the replacement is 1, so E will be replaced by F, D will be replaced by E, U will be replaced by V, C will be replaced by D, B will be replaced by C, and A will be replaced by B. So here, the plain text is EDUCBA, and the 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 in cracking the message as there are random substitutions and a large number of permutations and combinations are available.

#### 3. Homophonic Substitution Cipher

A homophonic substitution cipher is similar to a monoalphabetic cipher; the only difference is in a monoalphabetic, we replace the alphabet with any other random alphabet except the original alphabet, wherein in a homophonic substitution cipher, the alphabet is replaced by a fixed alphabet or set of alphabets. The substitution alphabet is replaced with the fixed one. 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. Polygram Substitution Cipher

In Polygram Substitution cipher, rather than replacing each alphabet with another, the alphabet’s 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 block. Let’s assume EDU will replace with LOD. In this type of cipher, plain text replacement is done 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 useful 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, and 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 useful, and 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 discuss the above-mentioned steps in detail manner the 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 alphabet (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 alphabet into groups (each group must contain two values). The encryption processes will be on these groups.
- If both alphabets in the group are the same, add x after the first alphabet.
- If both the alphabets 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 the row’s left side happens.
- If both the alphabets in the group are present in the same column, replace them with the next immediate alphabets 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 alphabets in the group are not in the same row or column, replace them with the alphabet 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 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 –