CBC (Cipher-block chaining) is a block cipher mode that trumps the ECB mode hiding away patterns in the plaintext. CBC mode achieves this by XORing the first plaintext block with an initialization vector before encrypting it. CBC also involves block chaining as every subsequent block is XORed with the ciphertext of the previous block.
where:
where:
The realest advantage CBC has over ECB mode is that identical blocks do not have the same cipher. This is because the initialization vector addds a random factor to each block.
Encryption is not tolerant of block losses. This is because blocks depend on their previous blocks for encryption. So, if a block is lost, the encryption of all subsequent blocks will not be possible. This chained behaviour also means that the encryption of blocks needs to be done sequentially, not in parallel. However, these disadvantages do not extend to decryption, which can be done in parallel if all ciphertext blocks are available and can tolerate block losses.