Skip to content
uencoder

ECB (Electronic Codebook)

ECB mode encrypts each block independently, so identical plaintext blocks produce identical ciphertext blocks; it is insecure and suitable only for single-block or random data.

Purpose

It is the simplest block-cipher mode, requiring no IV, but it exposes plaintext patterns.

Mechanism

Encryption is C_i = E_K(P_i), each block on its own: no chaining, no IV. Identical plaintext blocks map to identical ciphertext blocks, leaking data patterns (the famous ECB penguin). It is safe only when the data is smaller than one block or random (e.g., wrapping an RSA key).

Use cases

  • Encrypting a single key block (e.g., wrapping an RSA key)
  • Teaching counterexample
  • Legacy systems (should be migrated)
  • Random-data encryption

Examples

  • Input
    P1 P1 P2
    Output
    C1 C1 C2

    Identical plaintext → identical ciphertext

Common errors

Encrypting structured or repetitive data with ECB
Use GCM, or CBC with a random IV

Related terms

Related tools

References