Block Ciphers: CBC
Example of using CBC: Suppose that your plaintext is: 010 110, and the initial vector is 101. Also, suppose that you are given the following encryption function E(b) as a table:
Plaintext |
000 |
001 |
010 |
011 |
100 |
101 |
110 |
111 |
Ciphertext |
101 |
010 |
000 |
001 |
111 |
100 |
011 |
110 |
- To encrypt the plaintext, you'll work on one block at a time.
- First, we XOR the 1st plaintext block with the initial value to get: 010 ⊕ 101 = 111, and then plug the result into the table to get the ciphertext: E(111) = 110.
- To get the 2nd ciphertext block, we first XOR the 2nd plaintext block with the previous ciphertext, 110, to get: 110 ⊕ 110 = 000, and then plug the result into the table to get the ciphertext: E(000) = 101.
- To decrypt the ciphertext, you perform the actions above in the opposite order: you first solve E(b1) = 110, and XOR b1 with the initial value to get the 1st plaintext block. Then, you solve E(b2) = 101, and XOR b2 with the 1st ciphertext block to get the 2nd plaintext block.