Take the 2-minute tour ×

When changing a (small) part of the plaintext of a CBC-encrypted file, how much of the file will have to be rewritten?

My suspicion is that everything after the modified block will have to be decrypted and reencrypted as well, due to the changes of the ciphertext blocks cascading through the rest of the file.

share|improve this question

2 Answers 2

up vote 7 down vote accepted

If you could use the same IV, then yes, you would need to rewrite everything after the modified block.

But you shouldn't do that; every time the contents change, you should generate a new IV, which would require the whole file to be rewritten. Otherwise an attacker can learn more information than it should about how the file changed (precisely by checking which blocks of the file have changed).

share|improve this answer

As @Conrado stated this should not be done as it leaks some information that can be used by an attacker in order to make some statistical analysis. According to theory this is the diffusion property that a cryptosystems must hold: One bit flipping in the plaintext must change as much as possible the the bits on the ciphertext. The linear parts of a block cipher as AES achieve this.

share|improve this answer

Your Answer


