# Does it matter if IV is used as the first block of data before the encryption and then some fixed value is used for the actual IV? [duplicate]

Usually the IV for the crypto operations is chosen randomly and is sent together with the encrypted data [at the first block]. For decryption, the IV is first extracted from data and set separately in the crypto components (functions or HW peripherals) and then feed the crypto operation with data.

The other case is to set the IV always to fixed value but the first block of data is chosen randomly. In this case after decryption the first block will be just ignored!

In terms of result, I understand that the encrypted text are different but in terms of security does anybody know if it matters or not?

## migrated from stackoverflow.comMar 12 at 17:05

This question came from our site for professional and enthusiast programmers.

• Relevant but not duplicate: crypto.stackexchange.com/q/47328 – Squeamish Ossifrage Mar 12 at 18:09
• Not an answer to your question, but: Please consider using an authenticated cipher that works on messages of arbitrary byte lengths, like NaCl crypto_secretbox_xsalsa20poly1305, or AES-GCM, or AES-CCM. The concept of ‘CBC mode’ is not useful for application development; the security goal of unauthenticated encryption (IND-CPA, indistinguishability under chosen-plaintext attack) often fails to models what applications really need -- very few applications need no authentication; and you also have to worry about padding which is a notorious vector for attacks like POODLE. – Squeamish Ossifrage Mar 12 at 18:18