To better understand the difference between ECB and CBC mode of operation, let's do an experiment. Let's create two files. Now let's create one file. Let's Encrypt it once with ECB and Let's Encrypt it once with CBC using the same key and the same initialization vector. For ECB, you don't really need an IV, but we will use it anyway. And at the end, we'll use hexton to look at the different blocks, the different encrypted blocks.
So the first thing to do is to generate a key. All right, that's our key. And now let's Create a txt file secrets are out the air. All right. Let's call our file secrets 123. All right.
And Let's Encrypt that file. Now let's open it just to check out. It really is there it is. Open SSL krypt using a Aes 128, y, ECB and less use as our input, secrets tree and as our output that's two Ese encrypted. All right, now let's add up the key. And let's add up and initialization vector.
For our example, we'll just use string of characters. Alright, so let's see the file secrets. Yes, see? And that's the file. All right. And let's now encrypt the same file using CBC We will change it to the crow encryption one.
That's our file. And we will use CDC. We're using the same IP, we're using the same input. We're changing the output. So we can compare it later. And the same key and initialization vector.
Alright, so we have two files with encrypted text one was encrypted using ECB and the second one was encrypted using CBC. Now let's hex dump the first five secrets 123. And let's hex them, secrets EMC. Alright, so this was a very small sighs but you can see that using ECB, we see repetitions, repetitions of the same blocks using the same encryption key using CBC. There are no repetitions. Why?
Because we're exploring the output of the last block will be input with the plain text input of the next block. No repetitions.