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 + IVOutputciphertext + 16-byte authentication tagAEAD mode
Common errors
- Using ECB mode on structured data (the penguin image)
- Use GCM, or CBC with HMAC
Related terms
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. GLOSSARY
CBC (Cipher Block Chaining)
CBC mode XORs the previous ciphertext block with the current plaintext before encrypting, so identical plaintext blocks yield different ciphertexts; it requires a random IV but provides no integrity authentication. GLOSSARY
CTR (Counter Mode)
CTR mode turns a block cipher into a stream cipher: it encrypts an incrementing counter to generate a keystream that is XORed with the plaintext, supporting parallelism and random access, but provides no integrity. GLOSSARY
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. GLOSSARY
IV (Initialization Vector)
An initialization vector (IV) is an input that injects randomness into block-cipher modes so that the same plaintext produces different ciphertexts across encryptions. GLOSSARY
Nonce
A nonce (number used once) is a value used only once in encryption; similar to an IV but emphasizing uniqueness over randomness, it is common in stream ciphers and AEAD. GLOSSARY