GCM Mode: Authenticated Encryption Standard
What You'll Learn
You'll discover how GCM mode combines encryption and authentication into a single, efficient operation that protects both confidentiality and integrity.
The Problem with Encryption Alone
You've learned several block cipher modes like ECB, CBC, and CTR. These modes encrypt data (protect confidentiality), but they don't detect tampering. An attacker could flip bits in your ciphertext, and you wouldn't know until you decrypt—by then, it might be too late.
Enter GCM: Two-for-One Security
Galois/Counter Mode (GCM) is an authenticated encryption mode that gives you both:
- Confidentiality through CTR mode encryption
- Integrity through GHASH authentication
Think of it like sending a locked box (encryption) with a tamper-evident seal (authentication). If anyone touches the box in transit, the seal breaks, and you'll know immediately.
How GCM Works
GCM builds on CTR mode you already know:
- CTR encryption: Encrypts your data by XORing it with keystream blocks (counter-based)
- GHASH authentication: Runs in parallel, creating an authentication tag using Galois field multiplication
- Authentication tag: A short value (typically 128 bits) that proves the ciphertext hasn't been modified
The magic is that both operations happen simultaneously using the same key, making GCM very fast—especially with hardware acceleration (AES-NI).
Why GCM is Everywhere
GCM has become the gold standard for modern security protocols (TLS 1.2+, IPsec, disk encryption) because:
- Single pass for encryption and authentication (fast)
- Parallelizable (hardware-friendly)
- Detects both modified and forged ciphertext
Key Takeaway: GCM mode combines CTR encryption with GHASH authentication to provide both confidentiality and integrity in one efficient operation, making it the preferred choice for authenticated encryption today.