Symmetric block mode encryption is the cornerstone of pretty much everything we do in terms of encryption
on the Internet.
And it works really well and it's very very robust but block encryption has a problem.
Now what I'm going to use is a E-S encryption as an example here.
But what we're going to do is set up a a little diagram and I want to show you one little problem with
block encryption.
So let's start off by setting up a little encryption machine.
So I want to start off our diagram here is in the upper right hand corner.
Let's make like a little conveyor belt of ones and zeros that are coming out to be encrypted.
Remember the whole idea of block mode is that it's going to take a chunk of ones and zeros and it's
going to drop it into this encryption block where we apply the key.
And then it is output as encrypted text.
And I'm going to make another little conveyor belt here as we show each block.
Now I want you to look very closely here.
So as this runs you're going to see that we're only grabbing eight ones and zeros at a time.
Now if you've been watching in other episodes you know that we don't do anything a little 8 bit chunks.
Today's powerful symmetric block encryptions like abs are going to be working in an absolute minimum
at 64 bit chunks.
The reason I'm doing little 8 bit chunks is just to make the diagram a little bit easier for you to
understand.
So the bottom line is is that with any form of symmetric block mode if you grab that chunk and you drop
it through your encryptor with the key and you output it every time you grab a 64 bit chunk or whatever
the chunk size is and you keep encrypting it with the same key you're always going to get the same output.
So this mode which we call electronic codebook is a bit of a problem in that we run into situations
where patterns can appear.
Let me give you a great example.
This cute kid right here is my little grand niece Mattie.
Now what I want to do is take this image and I want to encrypt it.
So the problem we run into is that the individual pixels of most images are going to be of a particular
size and it depends on the type of file format jpeg or whatever you might have.
But what will start happening is if we encrypt this in ECB mode it's going to end up looking something
like this.
Yeah.
All the individual pixels are encrypted but because they're encrypted with the same block size with
the same key they keep coming out absolutely identical so it may not be a black pixel it might be a
yellow pixel but the bottom line is I can still make out Miss Mattie there.
So we've got a problem with symmetric block encryption.
The problem is is that we can generate patterns that can actually give away our data.
Now in that example I just showed you we're using a photograph that's pretty easy to make that out.
But we can run into the same types of problems with voice with databases with all kinds of stuff.
The patterns aren't as easy to show in a video but the same problems exist.
So what we do is we don't use ECB mode with our symmetric encryptions.
What we do instead is we use different types of what are known as block modes to obfuscate the data
better.
So there are a number of block modes that are on the exam.
So what I want to do is go through each one of them.
The basic trick to all of these different block mood's is that we're going to encrypt something and
then we're going to use that encryption to help encrypt the next one.
So we end up there really kind of like a chain and they're actually very interesting they're on the
exam.
So let's go through each and every one of these because you're going to see it you're ready.
The first black vote I want to show you is called Sipher block chaining or CBC.
So we've got our encryption methodology here we've got our plain text at the top we've got our output
text which is going to be we'll start loading there at the bottom.
And here's our encryption but we're going to do something different this time.
First of all we're going to add something called an initialization vector.
So here's an initialization vector.
It is the same size as the blocks themselves.
And what we're going to do is before we encrypted we're going to take that first block and we're going
to do an x or against this initialization vector then we're going to go ahead and encrypt it and put
the encryption output down there.
But we're also going to keep another copy.
And this is going to be used for the next block in that way.
What's happening is that we're not going to get the exact same data for every different key because
we're actually changing it a little bit every time.
Next is Sipher feedback now with Sipher feedback or CFB.
You're going to see it's actually pretty similar to what we just looked at in this case though we're
going to take that initialization vector and we're going to go ahead and encrypt we encrypt the initialization
vector and then we take the output of that encryption and we x or it to the first block.
So here we go ahead.
Outputs and and it just gets X ored to that first block.
So it comes in.
We put one copy of the output down on to the ciphertext and then we go Hinze cycle that output and use
that.
And we go ahead and encrypt that for the next one.
Third is output feedback.
Now with output feedback what we're gonna do is we're going to take one initialization vector and we're
going to go Edmond crypt that we're going to take the output of that encryption and we're going to X
or it to that first block then we go ahead and put that output there.
Now in this case what's actually kind of interesting is we just keep using that same initialization
vector C-T our counter is a little bit different than the others.
In this particular case what we're going to have is a non-SS Dahlia.
Now in this particular example it's only four bits long but again in the real McCoys it's much bigger
than this.
And then the counter value that continues to increment in binary.
So in this case what we're going to do is we're going to combine the non-SS and the counter we go ahead
and encrypt that and then we take the first block of the plain text an X or it to create the first block
of ciphertext the next time we do this all we do is we increment the counter so the counter gets incremented.
We go ahead and concatenate that to the non-SS we encrypt all that.
And then we go ahead and take that and output that to the second block.
The power of these different forms of block modes is that they get around this limitation of symmetric
block encryptions.
So by using anything other than ECB we should be able to do something like this.
So here's my cute little niece Mattie one more time and applying a good block mode to it.
It should look something like this.
Totally randomized data.
For the exam.
Make sure you're aware of the fact that number one nobody uses ECB anymore it's simply not done there
are a number of different block moods out there and different types of cryptosystems will take advantage
of them depending on what they need for their particular application.
In.