All Topics  
Block cipher modes of operation

 

   Email Print
   Bookmark   Link






 

Block cipher modes of operation



 
 
In cryptography
Cryptography

Cryptography is the practice and study of hiding information. In modern times cryptography is considered a branch of both mathematics and computer science and is affiliated closely with information theory, computer security and engineering....
, a block cipher
Block cipher

In cryptography, a block cipher is a symmetric key algorithm cipher which operates on fixed-length groups of bits, termed blocks, with an unvarying transformation....
 operates on blocks of fixed length, often 64 or 128 bits. Because messages may be of any length, and because encrypting the same plaintext under the same key always produces the same output (as described in the ECB section below), several modes of operation have been invented which allow block ciphers to provide confidentiality for messages of arbitrary length.

The earliest modes described in the literature (eg, ECB, CBC, OFB and CFB) provide only confidentiality
Confidentiality

Confidentiality has been defined by the International Organization for Standardization as "ensuring that information is accessible only to those authorized to have access" and is one of the cornerstones of information security....
 or message integrity, but do not perform both simultaneously.






Discussion
Ask a question about 'Block cipher modes of operation'
Start a new discussion about 'Block cipher modes of operation'
Answer questions from other users
Full Discussion Forum



Encyclopedia


In cryptography
Cryptography

Cryptography is the practice and study of hiding information. In modern times cryptography is considered a branch of both mathematics and computer science and is affiliated closely with information theory, computer security and engineering....
, a block cipher
Block cipher

In cryptography, a block cipher is a symmetric key algorithm cipher which operates on fixed-length groups of bits, termed blocks, with an unvarying transformation....
 operates on blocks of fixed length, often 64 or 128 bits. Because messages may be of any length, and because encrypting the same plaintext under the same key always produces the same output (as described in the ECB section below), several modes of operation have been invented which allow block ciphers to provide confidentiality for messages of arbitrary length.

Encryption
The earliest modes described in the literature (eg, ECB, CBC, OFB and CFB) provide only confidentiality
Confidentiality

Confidentiality has been defined by the International Organization for Standardization as "ensuring that information is accessible only to those authorized to have access" and is one of the cornerstones of information security....
 or message integrity, but do not perform both simultaneously. Other modes have since been designed which ensure both confidentiality and message integrity in one pass, such as IAPM, CCM
CCM mode

CCM mode is a block cipher modes of operation for cryptographic block ciphers. It is an authenticated encryption algorithm designed to provide both authentication and privacy....
, EAX
EAX mode

EAX mode is a Block cipher modes of operation for cryptographic block ciphers.It is an Authenticated Encryption with Associated Data algorithm designed to simultaneously protect both authentication and privacy of the message with a two-pass scheme, one pass for achieving privacy and one for authenticity for each block....
, GCM, and OCB
OCB mode

OCB mode is a block cipher modes of operation for cryptographic block ciphers....
 modes. Tweakable narrow-block encryption (LRW) mode, and wide-block encryption (CMC and EME) modes, designed to securely encrypt sectors of a disk, are described in the article devoted to disk encryption theory.

Initialization vector (IV)

All these modes (except ECB) require an initialization vector, or IV -- a sort of 'dummy block' to kick off the process for the first real block, and also to provide some randomization for the process. There is no need for the IV to be secret, in most cases, but it is important that it is never reused with the same key. For CBC and CFB, reusing an IV leaks some information about the first block of plaintext, and about any common prefix shared by the two messages. For OFB and CTR, reusing an IV completely destroys security. In CBC mode, the IV must, in addition, be randomly generated at encryption time.

Electronic codebook (ECB)

The simplest of the encryption modes is the electronic codebook (ECB) mode. The message is divided into blocks and each block is encrypted separately. The disadvantage of this method is that identical plaintext
Plaintext

In cryptography, plaintext is the information which the sender wishes to transmit to the receiver. Before the computer era, plaintext simply meant text in the language of the communicating parties....
 blocks are encrypted into identical ciphertext blocks; thus, it does not hide data patterns well. In some senses, it doesn't provide serious message confidentiality, and it is not recommended for use in cryptographic protocols at all.

Ecb Encryption
Ecb Decryption
Here's a striking example of the degree to which ECB can leave plaintext data patterns in the ciphertext. A pixel-map version of the image on the left was encrypted with ECB mode to create the center image:

The image on the right is how the image might look encrypted with CBC, CTR or any of the other more secure modes -- indistinguishable from random noise. Note that the random appearance of the image on the right tells us very little about whether the image has been securely encrypted; many kinds of insecure encryption have been developed which would produce output just as 'random-looking'.

ECB mode can also make protocols without integrity protection even more susceptible to replay attack
Replay attack

A replay attack is a form of Computer network attack in which a valid data transmission is maliciously or fraudulently repeated or delayed. This is carried out either by the originator or by an Adversary who intercepts the data and retransmits it, possibly as part of a Spoofing attack by Internet Protocol packet substitution ....
s, since each block gets decrypted in exactly the same way. For example, the Phantasy Star Online: Blue Burst
Phantasy Star Online

Phantasy Star Online is an online Role-playing game title, originally released for Dreamcast in 2000. A bugfix/upgrade edition, entitled Phantasy Star Online ver.2, was released for the Dreamcast the following year....
 online video game uses Blowfish
Blowfish (cipher)

In cryptography, Blowfish is a key ed, symmetric key algorithm block cipher, designed in 1993 by Bruce Schneier and included in a large number of cipher suites and encryption products....
 in ECB mode. Before the key exchange system was cracked leading to even easier methods, cheaters repeated encrypted "monster killed" message packets, each an encrypted Blowfish block, to illegitimately gain experience point
Experience point

An experience point is a unit of measurement used in many role-playing games and role-playing video games to quantify a player character's progression through the game....
s quickly.

Cipher-block chaining (CBC)

CBC mode of operation was invented by IBM in 1976. In the cipher-block chaining (CBC) mode, each block of plaintext is XORed with the previous ciphertext block before being encrypted. This way, each ciphertext block is dependent on all plaintext blocks processed up to that point. Also, to make each message unique, an initialization vector
Initialization vector

In cryptography, an initialization vector is a block of bits that is required to allow a stream cipher or a block cipher to be executed in any of several block cipher modes of operation to produce a unique stream independent from other streams produced by the same encryption key, without having to go through a re-keying process....
 must be used in the first block.

Cbc Encryption
Cbc Decryption
If the first block has index 1, the mathematical formula for CBC encryption is

while the mathematical formula for CBC decryption is

CBC has been the most commonly used mode of operation. Its main drawbacks are that encryption is sequential (i.e., it cannot be parallelized), and that the message must be padded to a multiple of the cipher block size. One way to handle this last issue is through the method known as ciphertext stealing
Ciphertext stealing

In cryptography, ciphertext stealing is a general method of using a block cipher mode of operation that allows for processing of messages that are not evenly divisible into blocks without resulting in any expansion of the ciphertext, at the cost of slightly increased complexity....
.

Note that a one-bit change in a plaintext affects all following ciphertext blocks. A plaintext can be recovered from just two adjacent blocks of ciphertext. As a consequence, decryption can be parallelized, and a one-bit change to the ciphertext causes complete corruption of the corresponding block of plaintext, and inverts the corresponding bit in the following block of plaintext.

Propagating cipher-block chaining (PCBC)

The mode was designed to cause small changes in the ciphertext to propagate indefinitely when decrypting, as well as when encrypting.