Electronic Code Book (ECB)

An interactive exploration of the simplest block cipher mode and why it's considered insecure

What is ECB?

Electronic Code Book (ECB) is the simplest mode of operation for block ciphers. In ECB mode, each block of plaintext is encrypted independently using the same key. This means identical plaintext blocks will always produce identical ciphertext blocks.

Try ECB Simulation

Pattern Recognition Problem

⚠️ ECB's Fatal Flaw

ECB mode reveals patterns in the plaintext because identical blocks encrypt to identical ciphertext. This makes it vulnerable to analysis attacks.

Pattern Example

The Famous Penguin Example

The most famous example of ECB's weakness is the "ECB Penguin" - when an image is encrypted with ECB, the outline remains visible!

Original Image

Clear patterns visible

ECB Encrypted

Patterns still visible! 🐧

Better Mode (CBC)

No visible patterns

ECB vs Other Modes

❌ ECB (Electronic Code Book)

  • Simplest mode
  • Parallel processing possible
  • No error propagation
  • ⚠️ Reveals patterns
  • ⚠️ Not semantically secure

✅ CBC (Cipher Block Chaining)

  • Uses initialization vector (IV)
  • Each block depends on previous
  • No pattern revelation
  • Semantically secure
  • Industry standard

Interactive Block Visualization

See How ECB Processes Blocks

⚠️ Security Warning

Never use ECB mode in production! ECB is considered cryptographically insecure because it reveals patterns in plaintext. Use CBC, GCM, or other secure modes instead.