New client-side protocols should use AES-GCM, and AES-CBC should stay only where encrypt-then-MAC is already correct and the wire format cannot change. That choice buys a 96-bit nonce and a 128-bit tag per record, encryption and integrity checked in one pass, and no padding for anyone to probe. Flip one bit in a GCM record and the tag check fails before plaintext is released; flip one bit in unauthenticated CBC and the ciphertext can still decrypt into attacker-shaped plaintext.
The popular version of that advice stops too early. GCM is authenticated, CBC is not, so ship GCM. It gets the destination right and the road wrong, because a mode label is not the security property. The mode is the easy part. What breaks systems is the plan around it: who generates the nonce, how the key is scoped, what error a failed tag produces, and whether anyone noticed that two browser tabs just walked off with the same counter value.
The useful question compares likely failures: a CBC padding or MAC mistake against a GCM nonce repeated under one key. Both are implementation bugs. They fail differently, and the blast radius is not the same.
AES GCM vs CBC at a Glance
Ship AES-GCM for anything new: chat messages, file uploads, voice frames, session tokens, any record that must arrive unmodified or not arrive at all. Keep AES-CBC only where a legacy stack already does encrypt-then-MAC correctly and the wire format can't change without breaking peers you don't control. Everything else is a migration project, not a design choice.
| Criterion | AES-GCM | AES-CBC |
|---|---|---|
| Built-in authenticity | Yes, GHASH authentication tag | No, needs a separate MAC |
| Associated data | Yes, AEAD can bind metadata | No |
| IV or nonce | 96-bit nonce, unique under the key | Unpredictable and unique IV |
| Padding | None | Required, padding-oracle risk |
| Block processing | Counter blocks can run in parallel | Each block waits on the previous ciphertext |
| Integrity check | One tag verified with decryption | Encrypt-then-MAC, verify the MAC first |
| Dominant failure | Nonce reuse under the same key | Missing MAC or distinguishable padding errors |
| Practical fit | New protocols, browser chat, files, voice | Legacy systems with proven encrypt-then-MAC |
Two cells get misread constantly. The dominant failure row doesn't rank the modes by safety; it relocates the danger. With CBC the danger lives in code you add (a MAC, a padding check, an error handler). With GCM it lives in a value you generate (the nonce). The integrity check row isn't the absence of integrity in CBC. It's a prescribed order: compute HMAC over the IV and ciphertext, verify it, and only then decrypt. Flip that order and every padding error becomes a signal an attacker can read.
How to use the rows as a checklist
Start at the top. If the requirement is "this message or file must be rejected if anyone touches it," the first row already decided the answer, and you stop at GCM. If a device or protocol peer only speaks CBC, keep reading down: you owe the system associated-data binding in a different place, a MAC with its own key, and one indistinguishable failure path for both bad padding and bad MAC.
What's missing from the table is raw speed, and that's deliberate. Speed moves with the CPU, the library build, payload size, and whether hardware crypto instructions are present, so a table cell would mislead you. A later section puts real numbers on it.
If you're planning crypto choices that have to hold up for the next decade, the asymmetric half of your stack needs its own migration plan. The DevArmor guide to post-quantum readiness for product security teams covers how teams stage that work without freezing the roadmap.
Authenticity IVs and Associated Data
AES-GCM is a complete construction. AES-CBC is half of one.
GCM combines counter-mode encryption with GHASH authentication, so a single operation protects the ciphertext and can also authenticate associated metadata that stays in the clear, such as a channel identifier or a frame timestamp. NIST's block cipher techniques project specifies GCM as an authenticated-encryption-with-associated-data mode and identifies GMAC as its authentication-only specialization. CBC provides confidentiality and nothing else. Integrity becomes a second construction, normally HMAC in encrypt-then-MAC order, with its own key, its own encoding of what gets covered, and its own verification rule.
That asymmetry is why each chat record in a GCM system carries exactly one tag, while a CBC system has to keep padding, IV, MAC, verification order, and error handling in agreement on every single record.

The caller duty each mode still leaves behind
Neither mode manages its own nonce for you. Under one GCM key the nonce must never repeat, which means a per-message counter or a securely generated unique value, and a bug here is a key-management failure rather than a cosmetic one. NIST notes that a 96-bit nonce is the preferred format because it can be processed directly, without the derivation overhead that variable-length nonces require. CBC has a parallel rule: unpredictable, non-repeating IVs and constant-time padding validation.
Swapping one for the other is not a one-line change. Moving to CBC adds a MAC, a padding scheme, an IV rule, a verification order, and an error policy, and each of those is a place to get it wrong.
Practical rule: write the nonce lifecycle down before you write the encrypt call. Where it comes from, who increments it, what happens after a page reload, and what happens when two tabs open at once.
The payoff for getting it right is concrete. If the tag is verified, an altered message, a tampered file, a doctored voice frame, or a rewritten protocol field is rejected before the application ever treats it as data. A channel admission check that decrypts a known test blob is one direct use of that property: a new participant is admitted to a Ciphar channel only if their browser derives the same key and successfully decrypts the channel's test blob, otherwise they never enter the channel. If you want the mechanics of the input side, this walkthrough of how an IV works follows the value from generation to reuse.
Padding Oracles Against Nonce Reuse
The useful question isn't which mode is safer in the abstract. It's which mistake your team is more likely to ship, and what an attacker gets when they do.
CBC ships without integrity. If the MAC is missing, or if it's verified after a padding check whose failure looks different to the client, a padding oracle lets an attacker recover plaintext or splice ciphertext. The oracle works like a guessing game that leaks one bit per query: a server that answers "bad padding" differently from "bad MAC" reveals whether a forged ciphertext decrypted to a valid block, and enough queries turn that single bit into recovered plaintext. The attack is a practical threat, and the 2025 TLS security guidelines from the Netherlands' NCSC recommend phasing out CBC precisely because secure use requires encrypt-then-MAC, which has limited client and server support and therefore cannot always be enforced across peers.
GCM deletes that attack surface. There's no padding to validate, and the tag covers ciphertext plus optional associated data. In exchange it creates a different hazard: NIST identifies IV uniqueness as critically important for GCM, because one repeated nonce under the same key exposes keystream and damages the authentication key. Reuse works like spending the same page of a one-time pad twice: XOR the two ciphertexts and the keystream cancels out, exposing the XOR of the underlying plaintexts.
| Failure | Mode | What leaks or breaks | Control that stops it |
|---|---|---|---|
| Distinguishable padding error | AES-CBC | Plaintext via a padding oracle | Constant-time checks, or leave CBC |
| MAC missing or checked too late | AES-CBC | Bit flips and ciphertext splicing | Encrypt-then-MAC, verify MAC first |
| Reused or predictable IV | AES-CBC | XOR of plaintexts that shared an IV | Fresh unpredictable IV per message |
| Nonce reused under one key | AES-GCM | Keystream reuse and auth-key damage | Unique 96-bit nonce, never reset blindly |
| Random nonce over a huge message count | AES-GCM | Eventual collision, same impact as reuse | Counter, or a tight per-key message budget |
The migration that doesn't finish the job
Moving a chat client from CBC to GCM is necessary and not sufficient. The security boundary shifts from padding and MAC composition to nonce lifecycle, key scope, and error handling, and a team that never thought about nonces is now trusted with them.
Vague advice to "use authenticated encryption" hides the two ways that goes wrong. A random 96-bit nonce can collide, and while the probability per message is tiny, a long-lived key with heavy traffic accumulates it. A counter fails differently: lose the state, restart the process, or let two encryption contexts run in parallel and the same value goes out twice.
Nonce reuse is not a rounding error. It is a total loss of confidentiality for the affected records plus a weakened authentication key.
Key management decides this in practice, because a nonce scheme is only as good as the key rotation policy sitting under it. Treating each conversation as a fresh key boundary removes most of the collision arithmetic, and the discipline in this guide to encryption key management applies directly to browser chat, where a key that outlives its channel buys you nothing but risk.
Pick the failure your team can prevent.
Speed for Messages Files and Voice
No single throughput number survives contact with real hardware. Results move with the CPU, the library, the message size, and whether AES-NI or ARM cryptographic extensions are present, which is why vendor-neutral "GCM is three times faster" claims are close to meaningless on their own.
The architectural difference is real and actionable. CBC encryption is sequential: each block's encryption depends on the previous ciphertext block, so the chain can't be split across cores. GCM's counter mode produces independent blocks that can be encrypted in parallel, and its GHASH authentication can often be accelerated in hardware, which is how NIST's authenticated encryption research explains a single streaming pass covering both confidentiality and integrity instead of a second HMAC pass.

Concrete examples show the shape of the difference without becoming a leaderboard. In one OpenSSL-backed Python wrapper benchmark, 64 KB of GCM encryption took about 30 microseconds against about 70 microseconds for CBC. On GPUs, wolfSSL's 2024 CUDA results report a 1.6× AES-GCM boost on NVIDIA A-series chips and 2.6× on H100 hardware, while AES-CBC could not be independently parallelized. And in 2024, a Linux kernel patch from Google added 1,223 lines of VAES and VPCLMULQDQ-optimized AES-GCM support for x86-64, which tells you where implementers are spending their effort.
| Benchmark | AES-GCM | AES-CBC | Caveat |
|---|---|---|---|
| 64 KB encrypt, OpenSSL-backed Python wrapper | about 30 microseconds | about 70 microseconds | Not a portable hardware score |
| Same wrapper versus another library | about 5.3 to 6.3 times on the OpenSSL path | Not reported in that comparison | Library comparison only |
| NVIDIA A-series, wolfSSL 2024 | 1.6× boost | Could not be independently parallelized | GPU result |
| NVIDIA H100, wolfSSL 2024 | 2.6× boost | Could not be independently parallelized | GPU result |
| Linux kernel x86-64, Google 2024 | 1,223 lines added for VAES and VPCLMULQDQ | Outside the scope of that patch | Shows where implementers spend effort |
| Short chat message | Often hidden by browser API, serialization, and network | Same overheads dominate | Gap shows on large files, voice streams, and concurrent channels |
A recorded comparison is worth ten minutes if you want the reasoning at full length.
Where the gap actually shows up
For a short chat line, the mode is rarely the bottleneck. Browser API overhead, JSON serialization, and network latency dominate, and GCM's advantage may be invisible per message. The gap appears on large encrypted files, sustained voice-frame streams, and many concurrent channels, where parallelizable authenticated encryption cuts CPU time and removes that second MAC pass.
Benchmark honestly: measure your target browsers and phones separately, with realistic payload sizes, tag verification, IV generation, key setup included, and concurrent tabs running. A tight loop that only calls encrypt measures the one thing your users never feel.
Real Workloads Where the Choice Changes
Earlier verdicts turn into bad decisions when they're applied blindly. These are the splits that matter.
New browser chat, encrypted file upload, live voice frames. Use AES-GCM. Every record needs one tag, payload sizes range from a single line to a multi-megabyte file, and a separate HMAC pass is another place to invert verification order under deadline pressure.
Session cookies and resubmitted tokens. Same answer, and this is the workload where CBC's failure is easiest to demonstrate. A cookie is attacker-controlled input that the server decrypts on every request, which is exactly the shape a bit-flipping attack wants. Authenticated tokens close it.
The cases people get wrong
Legacy VPN and TLS stacks that still offer CBC are a migration case, not a design to copy. Keep CBC there only while you're moving off it, and don't let an old appliance's cipher list set your application architecture.
Disk encryption is different. Full-disk tools use XTS, which is a mode designed for storage where the attacker sees many related ciphertext blocks, and its presence in your laptop's settings is no argument for CBC in a messaging protocol.
A closed legacy appliance can keep CBC, but only if it already verifies HMAC before decryption, uses unpredictable IVs, and returns uniform errors for every failure. If you can't confirm all three, you have a vulnerability, not a compatibility requirement.
For a one-hour identity-free chat room, the fit is honest and narrow. Journalists and sources, lawyers and clients, clinicians coordinating a case, and security researchers all need confidentiality with integrity and no account trail, and Ciphar's listed use cases are exactly those four groups. That combination matches an authenticated record with a short key lifetime. It doesn't replace a long-term messenger, and it's the wrong tool entirely where regulations expect an audit trail.
Browser Rules for Shipping GCM
In the browser you don't get a mode setting, you get WebCrypto calls with fixed shapes. AES-GCM takes a 12-byte nonce and a 128-bit tag. AES-CBC is a separate encrypt call that returns ciphertext you still have to MAC yourself, which means the first mode is a decision about nonce generation and the second is a decision about building a second primitive correctly.
The 2026 comparative study on CBC-encrypted session cookies landing on the migration write-up for authenticated tokens reported that AES-GCM rejected all 1,000 tested one-bit mutations before payload processing, that unauthenticated CBC accepted 12.6% of them, and that its GCM tokens were shorter and lower latency than CBC-HMAC. Those results are implementation-specific: JavaScript engine, record size, tag length, and batching can all move them.

The five shipping rules
- One key per channel, then discard it. Derive a 256-bit key from the access key and a per-channel salt, and let it die with the channel rather than serving a hundred conversations from one long-lived key.
- Take every nonce from the CSPRNG or a counter that cannot reset. 12 bytes, never repeated under that key, and never regenerated by a page reload or a second tab.
- Bind context in additional authenticated data. Channel identifier, message sequence number, expiry timestamp, and voice frame index belong in the AAD. Without that binding, a valid ciphertext can be replayed, reordered, or moved into another channel even though it can't be decrypted.
- Fail closed with one indistinguishable error. A bad tag, a wrong key, and a malformed record should produce the same response, so nothing leaks through differences in timing or wording.
- Drop replays using the sequence you bound. Keep a monotonic counter per sender inside the channel and reject anything at or below the last value you accepted.
A tag proves the bytes are intact and came from someone holding the key. It does not prove the message is new, in order, or intended for this channel. That's the AAD and replay work, and it's where browser chat implementations most often stop early.
Three checks before you ship
Forge a channel with a modified access key and confirm you're refused before any message renders. Flip a single ciphertext bit and confirm decryption fails rather than returning garbage. Then read what the relay is allowed to keep: anything beyond ciphertext, IV, tag, salt, and expiry deserves a hard question.
Fail closed, once: if a reviewer can tell the difference between a wrong key and a corrupted record, so can an attacker.
Ciphar encrypts each message, file, reply, and voice frame in the browser with AES-256-GCM before it touches the network, with the key derived from the access key using PBKDF2-HMAC-SHA-256 at 100,000 iterations. All randomness comes from the browser's native crypto random source. The channel model itself is documented in this guide to what an encrypted browser app can and cannot promise, which is the honest place to start before you build your own.
If you want to see these rules running instead of reading them, open Ciphar and create a channel: every message, file, reply, and voice frame is encrypted in your browser with AES-256-GCM before it leaves the device, and the relay only ever holds ciphertext, IVs, tags, salt, and an expiry. It's built for the short conversation you can't afford to have logged, with a 60-minute lifetime and no account. Try a one-hour channel with a colleague and watch what a wrong key does.



