Chapter 3 Cryptography 43
Cryptography Overview
Cipher Block Chaining (CBC) Mode
With CBC mode, each plaintext block is XORed with the previous ciphertext block,
then encrypted. CBC mode is as secure as the underlying block cipher against
standard attacks. In addition, any patterns in the plaintext are concealed by the
XORing of the previous ciphertext block with the plaintext block.
The decryptor follows the same sequence of steps to decrypt, using the same (secret)
key and initialization vector (IV).
Figure 3-4 Cipher-Block Chaining (CBC) Mode
An initialization vector is added to the beginning of the plaintext before encryption.
This gives you something to XOR the first block with and ensures that identical
plaintexts encrypt to different ciphertexts.
Cipher Feedback (CFB) Mode
In cipher feedback (CFB) mode, the cipher object acts as a byte generator. CFB mode
encrypts the previous block of ciphertext and XORs the plaintext with this block to
produce ciphertext. For the first block, the initialization vector is encrypted. CFB
mode is as secure as the underlying cipher against standard attacks. In addition, any
patterns in the plaintext are concealed by XORing the previous ciphertext block with
the plaintext block.
Key (K)
2nd message
block
2nd cipher
block
Block Cipher
Initialization
Vector (IV)
1st message
block
1st cipher
block
Block Cipher
XOR
XOR
Key (K)