# Question about Cipher Block Chaining(CBC)

I'm studying at the moment the CBC Encryption method,and I was asked in an excercise how many bits would be wrong after decryption if during the transmission 2 bits are interchanged. My guess is that the whole bits are wrong due to how CBC works, am I correct?

• Are the 2 bits side by side? Can they cross a block boundary? Can the bits have the same value (in which case there would be effectively no change), or are you guaranteed that the two bits that are interchanged have different values (one is a 0, the other is a 1)? Overall, however, you are not correct. Swapping 2 bits would not make all bits of the plaintext incorrect. – mikeazo Apr 27 '16 at 14:29
• Yeah I saw that while reading the paragraph again,it says the error on 1 block is propagated through the consecutive 2 blocks,so yes I'm wrong about my last statement. Btw the 2 bits are indeed different,and they are on 2 blocks that are consecutive. EDIT: let's say I have 8 blocks ,and during transmission 1 bit on the third block and 1 on the fourth block are interchanged,would wrong bits be in the 2nd, 3rd and 4th block? – vc73 Apr 27 '16 at 14:50

It depends on the position of the two interchanged bits. Assume they have different values, i.e. one is $0$ and the other is $1$. Indeed, if they had the same value, interchanging would not affect plaintext decryption.

Let's say $n$ is the length of every block.

In CBC, every ciphertext block is involved in two plaintext blocks decryption: its own and subsequent one, therefore if one CT is corrupted only two PT will be so.

To move back to your question:

## If $b_0$ and $b_1$ fall in the same block

2 plaintext blocks will be corrupted, $n+2$ bits will be corrupted.

## If $b_0$ and $b_1$ fall in two adjacent blocks

3 plaintext blocks will be corrupted, $2n+1$ bits affected.

## If $b_0$ and $b_1$ fall in two separate blocks

4 plaintext blocks will be corrupted, $2n+2$ bits affected.