2.3 Modes of Block Cipher Encryptions Ram Datta Bhatta Modes of Block Cipher Encryptions ✓Different techniques or strategies used to apply a block cipher algorithm to encrypt data of varying lengths. ✓Block ciphers operate on fixed-size blocks of data (e.g., 64 or 128 bits), but in practice, data to be encrypted can come in various lengths. Modes of encryption define how these variable-length data are transformed using the block cipher, ensuring confidentiality, integrity, and security ✓Block cipher is an encryption algorithm that takes a fixed size of input say b bits and produces a ciphertext of b bits again. If the input is larger than b bits it can be divided further. Modes of Block Cipher Encryptions There are several modes of operations for a block cipher as follows: 1. Electronic Code Book (ECB) 2. Cipher Block Chaining (CBC) 3. Cipher Feedback Mode (CFB) 4. Output Feedback Mode (OFM) 5. Counter Mode https://www.geeksforgeeks.org/block-cipher-modes-of-operation/ 1. Electronic Code Book (ECB) ✓The plaintext is handled one block at a time and each block of plaintext is encrypted using the same key ✓For a message longer than b bits, the procedure is simply to break the message into b-bit blocks, padding the last block if necessary Drawbacks • An attacker could uncover the key and thus have the key to decrypt all the blocks of data, or • An attacker could gather the ciphertext and plaintext of each block and build the code book that was used, without needing the key. ECB 2. Cipher Block Chaining (CBC) ✓ In CBC mode, the ciphertext from the previous block of data is used in encrypting the next block of data, ✓The input to the encryption algorithm is the XOR of the current plaintext block and the preceding ciphertext block; the same key is used for each block. ✓ In effect, we have chained together the processing of the sequence of plaintext blocks. ✓To produce the first block of ciphertext, an initialization vector (IV) is XORed with the first block of plaintext. ✓Parallel encryption is not possible since every encryption requires a previous cipher CBC 3. Cipher Feedback Mode (CFB) ✓In this mode the cipher is given as feedback to the next block of encryption with some new specifications: first, an initial vector IV is used for first encryption and output bits are divided as a set of s and b-s bits. ✓The left-hand side s bits are selected along with plaintext bits to which an XOR operation is applied. The result is given as input to a shift register having b-s bits to LHS, s bits to RHS and the process continues. 4. Output Feedback Mode • The output feedback mode follows nearly the same process as the Cipher Feedback mode except that it sends the encrypted output as feedback instead of the actual cipher which is XOR output. 5. Counter Mode • A counter equal to the plaintext block size is used. • Every time a counter-initiated value is encrypted and given as input to XOR with plaintext which results in ciphertext block. • The CTR mode is independent of feedback use and thus can be implemented in parallel • The counter is initialized to some value and then incremented by 1 for each subsequent block • https://www.youtube.com/watch?v=iaeKeZCHA1I&t=292s • https://www.youtube.com/watch?v=XgeBUPaTqPY