Skip to content
uencoder

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 bits
    Output
    different result on every encryption

    The 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

Related tools

References