Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Perl and Crypt::CBC question

by jimbojones (Friar)
on Jan 10, 2006 at 03:49 UTC ( #522080=note: print w/ replies, xml ) Need Help??


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


Comment on Re: Perl and Crypt::CBC question
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://522080]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (10)
As of 2014-12-22 11:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (116 votes), past polls