Skip to content
uencoder

GCM (Galois/Counter Mode)

GCM is an AEAD mode that combines CTR encryption with GHASH authentication, providing confidentiality and integrity at once, and is the preferred mode of TLS 1.2/1.3.

Purpose

It provides encryption and authentication in one pass, avoiding the two-step overhead and implementation pitfalls of CBC+HMAC.

Mechanism

CTR mode encrypts the plaintext. GHASH computes a polynomial MAC over the ciphertext blocks and AAD in GF(2^128) using the key H = E_K(0^128), producing a 128-bit authentication tag. If tag verification fails, the ciphertext is rejected.

Use cases

  • TLS 1.2/1.3 AES-GCM cipher suites
  • IPsec ESP
  • WPA3 wireless
  • Storage encryption

Examples

  • Input
    key + IV + plaintext + AAD
    Output
    ciphertext + 16-byte tag

    AEAD

Common errors

IV/nonce reuse breaks both confidentiality and integrity
Use a counter or random IV and never repeat it

Related terms

Related tools

References