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.
Purpose
It prevents identical-plaintext pattern leakage and provides semantic security.
Mechanism
The IV length usually equals the block size (e.g., 128 bits for AES). CBC requires an unpredictable (random) IV; CTR/GCM require uniqueness (a counter works). The IV need not be secret and is transmitted with the ciphertext. In GCM the IV is often called the nonce.
Use cases
- Random IVs for AES-CBC
- Unique nonces for AES-GCM
- IV storage in disk encryption
- Ciphertext identification and deduplication
Examples
- Input
AES-CBC IV=random 128 bitsOutputdifferent result on every encryptionThe IV is transmitted with the ciphertext
Common errors
- A fixed or predictable IV enables chosen-plaintext attacks
- Use a random IV for CBC and a unique nonce for CTR/GCM
Related terms
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
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
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
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. GLOSSARY