Skip to content
uencoder

Mode of Operation

A mode of operation is a scheme that lets a block cipher handle arbitrary-length data, defining how multiple plaintext blocks are chained during encryption; common ones include ECB, CBC, CTR, and GCM.

Purpose

It lets a fixed-block block cipher securely process variable-length data and can provide confidentiality, integrity, or authentication.

Mechanism

ECB encrypts each block independently (insecure); CBC XORs the previous ciphertext block into the next plaintext block; CTR encrypts counters to generate a keystream; GCM adds a GF(2^128) polynomial MAC on top of CTR. AEAD modes (GCM, CCM) provide confidentiality and integrity together.

Use cases

  • AES-GCM in TLS
  • AES-CBC for file encryption
  • AES-CTR for streaming encryption
  • AES-CCM in WPA2 wireless

Examples

  • Input
    AES + GCM + IV
    Output
    ciphertext + 16-byte authentication tag

    AEAD mode

Common errors

Using ECB mode on structured data (the penguin image)
Use GCM, or CBC with HMAC

Related terms

Related tools

References