Tags

, , , , , , , , , , ,

In an earlier post (The Foundation of Modern Cryptography) I explained how the conversion of plaintext and a password into ASCII binary gives us two inputs for an XOR function that generates a ciphertext stream, and that ciphertext stream is converted to ASCII ciphertext.

Block ciphers are a step forward from this – they’re still based on the XOR method, but the binary digits of the plaintext stream are grouped into blocks of a given size, before they’re XORed with the keystream and rotated. Once we get this concept, understanding the more technical literature becomes much easier.

The process for a basic block cipher, known as Electronic Code Book (ECB), is:
1. Convert plaintext into ASCII binary plaintext stream.
2. Convert password to ASCII binary keystream.
3. Group the digits of the binary plaintext stream into fixed-size blocks.
4. XOR each block with the keystream, and rotate X number of positions.

The problem with ECB is it’s relatively easy to break, given a ciphertext of sufficient length and a little cryptanalysis. Two identical plaintext blocks will return identical ciphertext blocks.

Cipher Block Chaining
To get around the weaknesses of ECB, we use a system that doesn’t encrypt each block independently, but ‘chains’ them, hence the name ‘Cipher Block Chaining‘. No two identical plaintext blocks should produce the same ciphertext here. The first block (or several) is XORed with the keystream, but all subsequent blocks are XORed with the ciphertext stream of the previous block.

The software implementation would be:
1. Convert plaintext into ASCII binary plaintext stream.
2. Convert password to ASCII binary keystream.
3. Group plaintext stream digits into fixed-size blocks.
4. XOR first block with keystream, and rotate x number of positions.
5. XOR second block with first block, and rotate x number of positions.
6. XOR third block with second block, and rotate x number of positions.
7. Continue process for all blocks.

Advertisements