Initialization Vectors

An initialization vector is a random number, usually the same number of bits as the block size, that is used as a starting point when encrypting a set of data. Initialization vectors are used only with those cipher modes that make use of feedback. This ensures that the effect of the initialization vector is propagated throughout the entire plaintext message being encrypted.

If initialization vectors are not used, then when two identical plaintext messages are encrypted with the same key, two identical ciphertext messages are generated. However, if each plaintext message is encrypted with a different initialization vector, the ciphertext messages generated are completely different.

You should always encrypt each message with a different initialization vector, particularly when the messages contain a large amount of duplication.

Applications using the CryptoAPI are responsible for transmitting the initialization vector along with the encrypted message. There is no need to encrypt this vector.