http://www.perlmonks.org?node_id=522080


in reply to Perl and Crypt::CBC question

For more general information, check out CBC in Wikipedia. The idea is that for each pass of the cipher over a 'block' (8 bytes or more), the plaintext is XOR'd with the previous encrypted block before it is encrypted. For this method, for the first block, you need something to XOR in with your block. Hence the "Initialization Vector" (IV).

To reverse the process (decrypt), you need to tell the CBC what the IV was. So either it's passed as an argument, or it's embedded in the ciphertext itself:
RandomIV12345678{real crypto text here}
here the IV is 12345678 (not too random).

Note that the IV isn't critical to the strength of the cipher, but is used to make attacks on the cipher more difficult, since the same piece of plaintext encrypted with the same cipher and key will lead to different encrypted text if you start with different (random) IVs.

- j