Explore our new Cybersecurity Terms Glossary, explained by our experts.

View the Glossary View the Glossary
PRIVIA

Cybersecurity Terms Glossary

What Are Initialisation Vectors and Nonces?

An initialisation vector or nonce is the extra input that makes encrypting the same message twice produce different ciphertext. Reusing one is among the most damaging mistakes in applied cryptography.

Illustration for the cybersecurity term Initialisation Vector and Nonce
Home / Blog / Cybersecurity Terms / What Are Initialisation Vectors and Nonces?
17 November 2026

What Are Initialisation Vectors and Nonces?

What Are Initialisation Vectors and Nonces?

Encryption with a key alone is deterministic: the same plaintext always yields the same ciphertext, which leaks repetition to anyone watching. The initialisation vector, or nonce, is the extra input that breaks that pattern. It is not secret — it travels alongside the ciphertext in the clear — and it has exactly one job, which is to be different every time.

The two words are used loosely, and the distinction matters because the requirements differ. A nonce (number used once) must be unique under a given key. An IV, in the modes that use the term, must additionally be unpredictable. A salt, which is sometimes confused with both, is a public value used in key derivation rather than encryption.

What Each Mode Demands

ModeValueRequirementConsequence of failure
CBCIV, 16 bytesUnpredictable and uniqueChosen-plaintext attacks; confirmation of guessed plaintext
CTRNonce plus counterUniqueKeystream reuse; plaintext recovery
GCMNonce, 12 bytesUniquePlaintext recovery and authentication key disclosure
XTSSector number as tweakUnique per sectorIdentical sectors become visible
GCM-SIVNonce, 12 bytesUnique preferred, tolerable if reusedOnly equality of messages leaks

The CBC case is subtler than it looks. A predictable IV lets an attacker who can inject plaintext test guesses about other data in the same stream, which is how the BEAST attack worked against TLS 1.0 in 2011: the IV for each record was the previous record’s final ciphertext block, and therefore known in advance. TLS 1.1 fixed it by using an explicit random IV per record.

GCM Nonce Reuse Is the Expensive One

With AES-GCM, repeating a nonce under one key does two things. First, the XOR of the two ciphertexts equals the XOR of the two plaintexts, which often recovers both. Second, and far worse, an attacker can solve for the authentication subkey H, after which they can forge valid tags for messages you never wrote. One mistake converts a confidentiality failure into an integrity failure for everything protected by that key.

This is not a theoretical concern. It has been found in VPN implementations, in hardware with weak boot-time entropy, and repeatedly in containerised applications where a counter starts at zero on every restart and the key is a long-lived secret from the environment.

Generating Them Correctly

  1. Random, from a cryptographic source. Twelve random bytes per message is the standard approach for GCM. With random 96-bit nonces, the birthday bound makes collisions likely after roughly 2^32 messages under one key, so rotate the key well before that — or, better, use a fresh data key per object as envelope encryption does.
  2. Deterministic counter. A monotonic counter never collides, provided the state genuinely persists. It is the right choice in long-lived connections such as TLS records, and the wrong choice anywhere a process can restart, fork, or be cloned from a snapshot.
  3. Split the space. In distributed systems, give each writer a distinct prefix and let it count within its own range, which avoids coordination.
  4. Let the library do it. Interfaces such as libsodium’s sealed boxes, Google Tink, or a cloud key management service manage nonces internally, which removes the most common source of the defect.

Mistakes We Keep Finding

All five are invisible in testing: the data encrypts, decrypts, and round-trips correctly. Only someone looking at the ciphertext, or at the code, notices. That is why cryptographic call sites are a standing item in our web application security services, and why storing the IV in plain sight next to the ciphertext is correct practice rather than a weakness.

FAQ – Frequently Asked Questions

Does the IV Need to Be Kept Secret?

No. IVs and nonces are designed to be public and are normally prepended to the ciphertext or stored in a header. Their security property is uniqueness, and for CBC also unpredictability, not secrecy. Trying to hide an IV adds no protection and usually complicates the code that has to retrieve it for decryption.

What Is the Difference Between a Nonce and a Salt?

A nonce makes each encryption of the same plaintext produce different ciphertext, and is used once per message under a key. A salt makes each derivation of a key from the same password produce a different key, defeating precomputed tables. Both are public and random; they operate at different stages and are not interchangeable.

How Many Messages Can One AES-GCM Key Safely Encrypt?

With random 96-bit nonces, keep below roughly 2^32 messages per key to stay clear of the birthday bound. With a guaranteed-unique counter the limit is far higher. The simplest answer in most architectures is to generate a new data key per object or per session, which removes the counting problem altogether.

Can I Reuse an IV If the Plaintext Is Different Every Time?

No. In counter-based modes the keystream depends only on the key and nonce, so two different plaintexts encrypted under the same pair are both recoverable from their ciphertexts. In GCM it also exposes the authentication subkey. Uniqueness is a hard requirement regardless of what the plaintext contains.

Related Terms

You May Be Interested In These

What Is Sigstore?

Cybersecurity Terms

17 November 2026

What Is Sigstore?

Read More
What Are NetFlow and IPFIX?

Cybersecurity Terms

17 November 2026

What Are NetFlow and IPFIX?

Read More