Introduction
Cryptography is the technique of converting a text that humans can easily read into a cryptic text that humans cannot understand without decoding it. There are many algorithms to convert normal text into cryptic text; such an algorithm is called Cipher. This is done to secure information exchange and communication.
Encryption is the process of converting normal (human-readable) text into coded text that is not in understandable human form. Decryption is the process of conversion of the cryptic text back into human-readable form.
Block cipher, as the name suggests, is an encryption technique in which the input plain text is divided into blocks of equal size (say x bits), and blocks of cyphertext of size equal to the plain text are generated.

In this article, we will discuss the modes of operations in Block Cipher i.e. methods for converting block plain text into cipher plain text.
Modes of Operations in Block Cipher
As mentioned above, Block cipher is a technique in which plain text is encrypted by dividing the text into blocks of equal size, producing blocks of cryptic text of the same size as the plain text.
There are five modes of operation of Block Cipher; let’s discuss them -
Electronic Code Block (ECB)
This is the simplest Block cipher method. This method simply converts the plain text into blocks of equal size. After this, we apply the encryption algorithm to them and create cipher text of equal block sizes.
👍 Advantage
This method is very simple. The plain text will be converted directly into cipher text.
Many blocks of plain text can be encrypted parallel to each other, thus making the process faster.
👎 Disadvantage
Even though it is a simple method, this method is not used practically. The main disadvantage is that in the case of repetitive plain text, the cipher text will also be repetitive, leading to low-quality cryptic text.
Cipher Block Chaining
Chaining is the process of connecting the present object with the previous object.
Cipher block chaining is also a type of Block chaining so the plain text is converted into blocks of text that are then encrypted.
In Cipher Block Chaining, we XOR the previous block's cipher text with the current block's plain text before applying the encryption algorithm.
Since, there will be no previous state for the first block, create an Initialization Vector (IV). Calculate the XOR of this Initialization Vector and Plain text and apply the encryption algorithm on the result to create the cipher text.
The size of the Initialization Vector is equal to the size of each block of plain text.
👍Advantage
1️⃣ All the blocks are connected to each other, so if the value in any of the blocks is changed then all the values in subsequent blocks will also be affected. Hence, the Cipher Block Chaining method can be used for authentication purposes.
2️⃣ It will generate different cryptic text for repetitive plain text, thereby overcoming the disadvantage of the Electronic Code Block mode.
👎 Disadvantage
As all the block phases are connected to each other, parallel encryption is NOT possible in Cipher Block Chaining.
Cipher Feedback Mode (CFB Mode)
The steps followed in this Mode are as follows -
✔️In this method, for the initial phase, an Initiation Vector (IV) of length ‘b’ bits is created and fed to the Shift Register.
✔️ This shifted value is then encrypted using a key ‘k.’
✔️ The encrypted value is divided into two parts of size ‘s’ bits and ‘b-s’ bits. The left-hand side ‘s’ bits are XORed with the ‘s’ bits of the plaintext, and the cipher text is produced.
✔️ The resultant cipher text is given as an input to the shift register having ‘b-s’ bits to the left-hand side and the ‘s’ bits to the right-hand side, and the process continues.
👍 Advantage
Some data is lost because of the left shift operation, so it is difficult to apply cryptanalysis.
👎 Disadvantage
Each phase is dependent on the output of the previous phase. Hence parallel encryption is not possible.
Output Feedback Mode (OFB Mode)
This mode is similar to the Cipher Feedback Mode. There are two differences -
1️⃣ Unlike the Cipher Feedback Mode, in Output Feedback Mode, the output encrypted text is sent as the input to the next phase instead of the final cipher text created by XOR between the plain text and the encrypted text.
2️⃣ The second difference is that the entire encrypted text is used to create the final cipher text instead of choosing only ‘s’ bits like in the Cipher Feedback Mode.
So, the steps of this mode are as follows -
✔️In this method, for the initial phase, an Initiation Vector (IV) of length ‘b’ bits is created and fed to the Shift Register.
✔️This shifted value is then encrypted using a key ‘k’.
✔️This encrypted text is sent as input to the next phase.
XOR operation is performed between the plain text and the entire length of the encrypted text and the cipher text is generated.
👍 Advantage
In the case of CFB, a single-bit error in a block is propagated to all subsequent blocks. OFB solves this problem as it is free from bit errors in the plaintext block.
👎 Disadvantage
It is more prone to message stream modification attacks.
Counter Mode (CTR mode)
In this mode, a counter-initiated value is created for every phase. This counter-initiated value is encrypted.
This encrypted value is given as an input to the XOR operation with plain text, and a ciphered text is generated.
A new counter-initiated value is used in every phase. Hence we can apply parallel encryption.
👍 Advantage
As each phase is independent of the next phase, parallel encryption is possible.
👎 Disadvantage
A synchronous counter is required. In the absence of this synchronous counter, the value of the plaintext will be changed.