×

# Mode of Operation in Cryptography

Cryptography | Mode of Operation: In this tutorial, we will learn about the mode of operation and its types. We will cover the types of messages in the mode of operation. By Monika Sharma Last updated : May 25, 2023

## Mode of Operation

Modes of operation of a block cipher are procedural rules for a generic block cipher. The different modes of operation result in different properties being achieved which add to the security of the underlying block cipher in the cryptography.

The block cipher processes the data blocks of fixed size in the character. Eventually, the size of a message is larger than the block size in the modes. Hence, the long message is divided into a series of sequential message blocks which divides it into blocks, and the cipher operates on these blocks one at a time in the cryptography.

## Types of Mode of Operation

There are 5 types of mode of operation,

1. Electronic CodeBook (ECB).
2. Cipher Block Chaining (CBC).
3. Cipher feedback (CFB).
4. Output Feedback (OFB).
5. Counter Mode (CTR).

### 1) Electronic Codebook (ECB)

This Electronic Code Book (ECB) is cryptography as a mode of operation for a block cipher, with the characters the main things that every feasible block of plaintext or an original text has a corresponding characteristic of ciphertext value and vice versa. In other words, the same or main plaintext or original value will always result or work in the same ciphertext value. Electronic Code Book(ECB) is used when a volume or character of plaintext is separated or divided into several blocks of data, each or every of which is then encrypted independently divides it into other blocks.

### 2) Cipher Block Chaining (CBC)

This Cipher block chaining (CBC) is a cryptography mode of operation for a block cipher (one in which a sequence of bits are encrypted as a single unit or a block with a ciphertext or encrypted key applied to the entire block of the cryptography). Cipher block chaining uses what is known as an initialization vector (IV) of a certain length of a character. There are one of its key characteristics is that it uses chaining the working mechanism that causes the decryption of a block of ciphertext to depend on all the preceding ciphertext blocks. As a result, the entire validity of all preceding blocks is contained in the cryptography immediately previous ciphertext block.

### 3) Cipher Feedback Mode (CFB)

This is Ciphertext feedback (CFB) which is also a mode of operation for a block cipher. In contrast to the cipher block chaining(CBC) mode, which encrypts a set number of bits of plaintext or original text at a time, it is at times desirable or sensible to encrypt and transfer or exchange some plaintext or original text values instantly one at a time, for which ciphertext feedback is a method in cryptography. Like cipher block chaining(CBC), ciphertext feedback(cfb) also makes use of an initialization vector (IV) in the blocks.

### 4) Output Feedback Mode (OFB)

This is an output feedback (OFB) mode that is similar in structure to that of CFB in cryptography. It is the output of the encryption function that is fed back to the shift register in OFB in the cryptography, whereas in CFB in the mode of blocks, the ciphertext unit is fed back to the shift register in the block. The other difference is that the OFB mode operates on full blocks of plaintext or original text and ciphertext, not on an s-bit subset of character.

### 5) Counter Mode (CTR)

The Counter Mode or CTR is a simple counter based block cipher implementation in cryptography. Each or every time a counter initiated value is encrypted and given as input to XOR with plaintext or original text which results in ciphertext block. The CTR mode is independent of feedback use and thus can be implemented in parallel in this mode. It generates the next keystream block by encrypting successive values as named as "counter". This counter can be any purpose or function which generates a sequence that is guaranteed not to call for a long time, although an actual increment-by-one counter is the simplest or easiest and most popular or famous.