in reply to Crypt::CBC question
To start out though, you need an extra block, so that's where the IV comes in. It's combined with the first message block into the first iteration.
Most hashing algorithms have a fixed IV, so that everyone agrees that the same file will have the same hash value.______ IV --> | hash | ______ msg[1] --> |_func_| --> | hash | msg[2] ---------------> |_func_| --> msg[3] ----------------------------> ...
I'm not familiar with CBC, but I seem to recall that if you use a streaming/cascading cipher (where encryption results cascade to affect the next block), you'd also need an IV. If you can choose the IV yourself it will add some extra entropy, like having a longer key size. Also, a streaming cipher will prevent an attacker from detecting identical plaintext blocks from two snippets of ciphertext (unless they use the same IV and are at the very beginning of the plaintext). Of course, the person decrypting the message will need to know the IV you used.
I'm sure someone more familiar with CBC can give you a little more info ;) ...
blokhead
|
|---|