Symmetric block ciphers (like AES) process data in fixed blocks of 128 bits. The method used to coordinate block encryption is called the Cipher Mode.

1. Electronic Codebook (ECB) Mode

In ECB mode, each plaintext block is encrypted independently using the same key.

  • Vulnerability: Identical plaintext blocks produce identical ciphertext blocks.
  • Result: Data patterns are preserved. For example, if you encrypt a bitmap image using ECB mode, the outlines of the image remain visible in the encrypted result!
  • Verdict: Never use ECB mode for multi-block data.

2. Cipher Block Chaining (CBC) Mode

CBC mode introduces chaining by XORing each plaintext block with the previous ciphertext block before encryption.

  • This randomizes the input for each block, ensuring identical plaintext blocks result in completely different ciphertext.
  • Requires a unique, random Initialization Vector (IV) for the first block.