-A cipher needs an initialization vector (IV) when it is used in certain modes -such as CBC or GCM. Under the same secret key, IVs should be unique and ideally unpredictable. -Given a secret key, if the same IV is used for encryption, the same plaintexts result in the same ciphertexts. -This lets an attacker learn if the same data pieces are transferred or stored, -or this can help the attacker run a dictionary attack. +When a cipher is used in certain modes such as CBC or GCM, it requires an initialization vector (IV). +Under the same secret key, IVs should be unique and ideally unpredictable. +If the same IV is used with the same secret key, then the same plaintext results in the same ciphertext. +This can let an attacker learn if the same data pieces are transferred or stored, or help the attacker run a dictionary attack.
SecureRandom.
-The following example initializes a cipher with a static IV which is unsafe: +The following example initializes a cipher with a static IV, which is unsafe: