Encrypt the same short note twice with the same passphrase and you get two strings that share not a single visible character. That looks like a bug until you meet the IV: a small random value whose whole job is to make every encryption a one-off.

This explainer uses the Encryption Playground on Ovatly as the working example, because its OVAT1 output string carries the IV in a documented position where you can point at it. By the end you will know what an IV is, why reusing one is the classic way to break AES-GCM, and how the salt sitting next to it covers the other half of the same problem.

Contents

  • Quick answer
  • Where the IV lives in an OVAT1 string
  • What the IV actually does
  • Why identical messages must not encrypt identically
  • The classic failure: a reused IV
  • The salt: the same trick, played on the key
  • How to see a fresh IV in action, step by step
  • Limitations and honest tradeoffs
  • Common mistakes
  • FAQs
  • Conclusion
  • References

Quick answer

An IV, short for initialization vector, is a random starting value fed into an encryption alongside the key. In the Encryption Playground, every encryption generates a fresh 12-byte IV and stores it inside the OVAT1 string, next to a 16-byte salt and the ciphertext. Because the IV is new each time, the same message and passphrase produce a different string on every run, and because a repeated IV under one key is the classic AES-GCM failure, the tool never lets an IV repeat or be chosen by hand.

Where the IV lives in an OVAT1 string

An OVAT1 string is a documented layout encoded in Base64: a version byte, a 16-byte salt, a 12-byte IV, and then the ciphertext. When this exact string was produced from the note "Meet at the old depot at 9" with the passphrase "library card", the result was:

OVAT1.AY2T35LSmwcqthg/FH3lhifhB29/Ni7STzQzPHDt3yhv5oZBPZGgi2TiokVf9rEH8Xv7qb3j7jgB40e+fhDRKa6qfyllxLc=

Somewhere in the early bytes of that string, before the ciphertext begins, sits the IV for that one encryption. It is not hidden and it is not encrypted itself. The decrypt side reads it straight back out of the string, which is why you never have to note it down, send it separately or remember it.

What the IV actually does

Encryption takes a key and a message and produces ciphertext. If nothing else varied, the same key and the same message would always produce the same ciphertext, like a codebook. The IV breaks that determinism. It is mixed into the start of the encryption process, so the output depends on three inputs: the key, the message and this run's IV.

Change only the IV and the entire ciphertext changes, even though the key and the message are identical. The IV does not need to be secret to do this job. It needs to be unique for each encryption under a given key, and randomness is the practical way to guarantee that uniqueness without keeping a counter or a register of past values.

Why identical messages must not encrypt identically

Suppose the IV were fixed, and you encrypted the note "Meet at the old depot at 9" today and again next week with the same passphrase. Both strings would come out identical. Anyone holding both strings learns something real without decrypting anything: the same message was sent twice. Across many messages, those repeats become a pattern, and patterns are what codebreaking has always fed on.

With a fresh IV, the two strings are unrelated from the first character to the last. A repeated message hides among all the others. That is the whole service the IV performs: identical messages do not advertise themselves.

The classic failure: a reused IV

AES-GCM, the method this tool uses, is especially unforgiving about IV reuse. Encrypt two different messages with the same key and the same IV, and the relationship between the two ciphertexts starts leaking information about the two plaintexts; the authentication tag that is supposed to catch tampering is weakened as well. Cryptographers treat key-plus-IV reuse in GCM as the one mistake that quietly undoes the algorithm.

The defence is boring and total: never reuse. The tool generates 12 fresh random bytes for every single encryption, so a repeat is not merely discouraged, it is practically impossible to arrange. You cannot pick an IV, reuse an old one or switch the randomness off, and that absence of choice is the safety feature.

The salt: the same trick, played on the key

The OVAT1 string carries a second random value, the 16-byte salt, and it does for the key what the IV does for the encryption. The key is not your passphrase; it is derived from the passphrase with PBKDF2-HMAC-SHA-256 at 210,000 iterations, and the salt is an input to that derivation. A fresh salt means the same passphrase derives a completely different key every run.

So each encryption is randomised twice over. The salt makes the key unique, and the IV makes the encryption unique even in the rare case where two keys matched. Either one alone would stop identical messages producing identical strings; together they mean no two OVAT1 strings ever share a visible pattern.

How to see a fresh IV in action, step by step

  1. Open the Encryption Playground and type a short note on the Encrypt tab, with any passphrase.
  2. Press Encrypt and copy the OVAT1 string into a note somewhere.
  3. Press Encrypt again without changing anything. The new string will differ from the first in every character.
  4. Paste each string into the Decrypt tab in turn, with the same passphrase. Both come back as your original note, because each string carries the exact salt and IV its own decryption needs.

Limitations and honest tradeoffs

The IV protects uniqueness, not strength. A weak passphrase stays weak no matter how fresh the IV is, because an attacker guesses passphrases, not IVs, and the IV is public inside the string anyway. Nor does the IV hide the length of your message; a longer note still produces a longer string.

Remember too what this tool is: a learning tool with its own OVAT1 format that only this tool can open, not a standard like PGP or age, and not a safe place for banking passwords or real secrets. And if you lose the passphrase, no freshness of IV or salt helps: there is no recovery, and the message stays unreadable permanently.

Common mistakes

  • Thinking the IV must be kept secret. It travels openly in the string by design. Guard the passphrase instead.
  • Expecting identical output for identical input. Different strings every time are the system working, not failing.
  • Assuming a fresh IV fixes a weak passphrase. It does not. Uniqueness and strength are separate problems.
  • Trying to set or reuse an IV manually. In this tool you cannot, and in your own code you should not: random and fresh is the rule.
  • Ignoring the salt. Half the uniqueness comes from the salt in the key derivation; an IV alone is not the whole story.

FAQs

Is the IV a secret like the passphrase? No. The IV travels in plain sight inside the OVAT1 string, right next to the ciphertext. Its job is uniqueness, not secrecy. The passphrase is the secret; the IV only has to be fresh and never repeated with the same key.

Why do two encryptions of the same note look completely different? Because both the IV and the salt are freshly random on every run. A new salt derives a different key from the same passphrase, and a new IV changes the encryption itself, so the two strings share nothing visible.

What actually goes wrong if an IV is reused? With AES-GCM, encrypting two messages under the same key and the same IV is the classic failure: patterns between the two ciphertexts leak information about the plaintexts, and the authentication protection is undermined. Fresh random IVs make a repeat practically impossible.

What is the difference between the salt and the IV? They randomise different halves of the process. The salt feeds PBKDF2, so the same passphrase derives a different key each time. The IV feeds the AES-GCM encryption, so the same key and text still encrypt differently. The OVAT1 string carries both.

How long is the IV in this tool? Twelve bytes, sitting inside the OVAT1 string after the version byte and the 16-byte salt, before the ciphertext. It is generated for you on every encryption; there is nothing to set or remember.

Conclusion

The IV is a small value with one job: make every encryption a unique event, so messages never repeat themselves visibly and the AES-GCM failure mode of a reused IV never gets a chance. The salt beside it plays the same trick on the key. For the full round trip that uses both, read how to encrypt a short message with a password, and browse the rest of the Security and Privacy guides for the companion tools.

References