Given a block cipher that processes finite bits,

block cipher operation modes provide ways to handle

plaintext that is longer than a block in a secure manner.

In other words, the cipher is given and block cipher operation modes

provide ways to use that block cipher function

multiple times to encrypt a longer plain text.

Before we describe the block cipher operation modes,

let's define the variables that we will use in this module.

'b' is the block length and bits.

In the previous module we also used the variable and to represent the block length.

But it is fine as long as we keep track of the variable definitions.

So let's stick to the variable b in this module.

So b is the number of bits in a block,

'P' is the block of plaintext bits comprised of b bits,

and because we will use multiple blocks,

the P with an index of 'i' is the i-th block.

Similarly, 'C' denotes the ciphertext block and C_sub_i corresponds to the i-th block.

Let's first start off with a simple mode of

block cipher operation called Electronic Code Book or ECB.

Given on encryption and a decryption function which are represented

as Enc box and a Dec box on the diagram.

The encryption and the decryption processes is shown next to me.

Alice wants to communicate to Bob and suppose, for the time being,

Alice's message or the plaintext length is as long as that of the Cipher Block Function.

Alice encrypts and sends the ciphertext to Bob and then Bob

which receives the ciphertext and decrypts it to retrieve the plaintext.

That is P_sub_1 is the b bit long plaintext that Alice wants to communicate to Bob

and C_sub_1 is the corresponding output when P_sub_1 is the input to the Enc function.

After receiving or accessing the C_sub_1,

Bob inputs C1 and the key K

to the decryption function to retrieve the original message of P1.

The encryption and decryption function supports input and output that are b bits long.

When the data plaintext becomes longer,

ECB, or Electronic Code Book mode,

merely takes the same key and inputs that to all of the following blocks for encryption.

Similarly the corresponding ciphertext are also decrypted using the same key,

K, as the input for decryption blocks.

All the encryption processes for P_sub_i's are

independent to each other as well as the C_sub_i's for the decryption.

While the plaintext that varies,

the rest of the processes are the same across the blocks.

Therefore, the operation mode is named Electronic Code Book because the encryption and

decryption can use a code book

that has a table for the mapping between the plaintext and the ciphertext.

We can also represent the ECB mode in mass by using an index variable,

in this case i, to capture i-th block.

The plaintext varies and so does the corresponding ciphertext,

but the rest of the operation remains intact.

C_sub_i is a function of K and P_sub_i for the encryption where

the function Enc is given by the encryption cipher.

Similarly for decryption, P_sub_i is a function of K and C_sub_i where

the function Dec is the given the decryption cipher.

If the message is highly structured and have regular patterns,

it may be possible for a cryptanalyst to exploit those regularities.

If the message has repetitive elements with a period of repetition a multiple of b bits,

then these elements can be identified by the analyst.

This may help in the analysis and can also provide an opportunity for the

attacker to substitute or rearrange blocks.

Because of these reasons,

ECB is not appropriate for encrypting a large amount

of data since repetitions can be seen after the encryption.

For example, let's look at a case in graphics.

Shown next to me is the before and the after all of the ECB-based encryption of an image.

Even though the colors change,

you can still recognize the shape of

the original picture and can infer that it is a picture of a mountain.

Such vulnerability comes from the fact that each block of

b bits are processed independently and because of that,

the plaintext data has regular patterns.

To prevent such regular patterns from showing up,

the main use or the popular use of ECB limits

the plaintext length and is often time used to send one or very few number of blocks.

For example, to communicate a session encryption key.

Such issue with ECB motivates us to

use a more sophisticated block cipher mode operations,

which will be the topics for the rest of this module.

In contrast to ECB,

we will now introduce processing dependency between blocks.