Let's now examine block cipher modes as you now know you have to split a variable length plaintext into
two fixed length blocks.
The length is determined by the algorithm that you want to use.
The way in which blocks are split is critical for the security of the entire ciphertext.
We're moving into cryptographic systems now.
Even a very secure algorithm if it's ill implemented poses the ciphertext to be extremely vulnerable.
Well prove it in a moment.
How can you transform data streams into fixed length blocks.
There are several common blocks for modes of operation.
The first is rather euphemistically called the electronic codebook mode BCB
the second mode of operation is Sipher block chaining CPC.
The third book cover is the counter mode C TR.
Finally there are two similar modes of operation that we'll mention together.
There are the so-called feedback modes CFB and OFB.
Let's start with the electronic codebook mode.
I assume you're a programmer.
Your task is to split along a block into pieces you need to perform the same operation on each piece.
What should you do in this case.
Right a loop split the data into pieces.
Encrypt the first one and then another one and so on.
This is how the electronic codebook mode of operation works.
The plaintext is split into blocks of the same length and each block is encrypted separately.
First this means that if the plaintext in two blocks repeats you'll receive two cipher texts that are
the same.
Each block will be encrypted into the same form.
This is not a good solution.
Secondly this allows you to modify the ciphertext in a way that is transparent for the recipient.
You can insert some blocks into the ciphertext encrypt them and thus change the content of the original
message.
The electronic codebook mode causes the security of the cipher to become non-existent.
You should not use it under any circumstances other modes don't have these shortcomings.
Let's take a look at this.
For block chaining mode.
The point here is finding some relationship between individual blocks as we have seen before separate
encryption is not the best idea.
That's why Sipher block chaining mode encryption involves Ekso oring combining the first block after
encryption with the next block.
The second block is also encrypted ex-SO hard and combined with the third block and so on.
This is a simple and elegant solution.
There's one problem though what to do with the first block.
There's nothing there.
Combine it with we must use an initialization vector of some sort.
What are the advantages of Sipher block chaining mode first of all the initialization vector does not
have to be encrypted.
It's a pseudo random string.
There's no point in encrypting something that is already random to make it more random remember her
cost principal the security of the ciphertext must depend solely on the security of the key.
The second strength of this mode is that if you encrypt the same data using the same key the output
will be different.
This is because the initialization vector is random
Also Also if during transmission the message block becomes corrupted it doesn't cause further damage.
Obviously more people to the block.
But this doesn't affect other blocks.
If you combine the corrupted parts using the export operation it will all be cancelled out other blocks
will be readable and scriptable that Seiffert block chaining mode is the default block cipher mode of
operation utilized in nearly all Microsoft solutions.
Let's move on to the OFB and CFB feedback modes.
The concept involved here is a bit different in that a simulation is performed that essentially changes
a block cipher into a stream cypher.
How can this be attempted if you generated a key that it has the same length as the plaintext.
This would in fact create a stream cypher using the x or operation kibitzer combined with plaintext
bits the implementation is as follows.
Both modes contain shift registers.
You've seen bit shifting before
shifting in the two months differs in that the operation is applied either at the start before encrypting
or after encrypting the bits will be shifted in one place or the other.
This is the difference between CFB and Opeth be at any rate you need an initialization vector.
It'll be the starting point to a cipher function.
Remember that a key of inappropriate length has to be generated next selected initialization vector
bits and ex-SO are them with plaintext bits the output of this process is the first encrypted block.
It is then shifted and the operation repeats
the last mode will mention is the counter mode C TR this motiv operation has gained wide popularity.
One of the strengths it has is that you can decrypt a selected part of the ciphertext.
You don't have to decrypt the whole of it
this idea is similar to the one applied in the previously mentioned modes.
After selecting an initialization vector encrypt it thus making the key longer and then combine it using
the x or operation with the plaintext.