# Mode of Operation in Cryptography

This article is about the **Mode of operation**. In this article, we will briefly study the **basic mode of operation and its types** aim to capture. We will cover the types of messages in Mode of Operation.

Submitted by Monika Sharma, on February 10, 2020

**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 operations

There are 5 types of mode of operation,

- Electronic CodeBook (ECB).
- Cipher Block Chaining (CBC).
- Cipher feedback (CFB).
- Output Feedback (OFB).
- 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 is a 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.

TOP Interview Coding Problems/Challenges

- Run-length encoding (find/print frequency of letters in a string)
- Sort an array of 0's, 1's and 2's in linear time complexity
- Checking Anagrams (check whether two string is anagrams or not)
- Relative sorting algorithm
- Finding subarray with given sum
- Find the level in a binary tree with given sum K
- Check whether a Binary Tree is BST (Binary Search Tree) or not
- 1[0]1 Pattern Count
- Capitalize first and last letter of each word in a line
- Print vertical sum of a binary tree
- Print Boundary Sum of a Binary Tree
- Reverse a single linked list
- Greedy Strategy to solve major algorithm problems
- Job sequencing problem
- Root to leaf Path Sum
- Exit Point in a Matrix
- Find length of loop in a linked list
- Toppers of Class
- Print All Nodes that don't have Sibling
- Transform to Sum Tree
- Shortest Source to Destination Path

Comments and Discussions

**Ad:**
Are you a blogger? Join our Blogging forum.