Skip to main content

Block Ciphers

A symmetric encryption algorithm that encrypts data in set chunks, with varying chunk sizes.

Common sizes range from 64, 128, and 256 bits of length. Notice something? Something about all of them being powers of 2? You know, $2^6$, $2^7$, and $2^8$? When the data doesn't fit into the set block size, random bits are used to fill in the remaining space.

There are six modes of operation when using block ciphers.

Operation Mode
Description
Electronic Code Book (ECB) The simplest mode. Each block of plaintext is encrypted separately. However, blocks with identical data will generate the same ciphertext.
Cipher Block Chaining (CBC) Uses an initialization vector (IV), which is a random starting variable that's XORed with the plaintext of the current block to begin the encryption chain. The IV for the next block is the ciphertext of the previous block.
Cipher Feedback Mode (CFB) Also uses an IV,IV but encrypts it first before applying to the beginning block. It's the equivalent of using aan OTP on the data.

Output Feedback Mode (OFB)

Identical to CFB, except for the IV used after the first round. The output of the IV encryption is used as the next block's ciphertext.

Counter Mode (CTR)

Uses a nonce combined with a counter that is encrypted, where a nonce is a random string used for all blocks during encryption and, and the counter is a literal counter used to ensure that blocks with identical data don't produce the same 

Galois Counter Mode (GCM)

Exactly like CTR, except GCM provides authentication as well. The output of GCM encryption results in encrypted data and a Message Authentication Code (MAC, not to be confused with MAC)