Block Cipher Modes of Operation

Work in progress. This note is still being written and incomplete.

3 min read Last updated Sun Jul 05 2026 05:11:45 GMT+0000 (Coordinated Universal Time)

AES, the successor to DES, is based on the substitution-permutation network (SP-network) design of Rijndael, rather than the Feistel structure.

SP-Network

Proposed by Claude Shannon in 1945: a series of linked permutation and substitution operations.

  • Diffusion
    Permutations disperse the statistical characteristics of each input bit among all output bits.
  • Confusion
    Substitutions create a complex relationship between the input and key with the output, providing the cipher’s non-linearity.

Modes of Operation

A mode of operation combines a block cipher into a usable block encryption scheme. DES was standardized with 4 modes:

  • ECB, useful for encrypting short secrets such as session keys.
  • CBC, useful for bulk data encryption.
  • OFB, useful for real-time streamed content.
  • CFB, useful for streamed content.

CTR mode, enabling parallel block encryption, was developed later.

ECB

Electronic Code Book: each plaintext block is encrypted independently.

ciek(mi),midk(ci)c_i \leftarrow e_k(m_i), \quad m_i \leftarrow d_k(c_i)

CBC

Cipher Block Chaining: chains each ciphertext block into the encryption of the next, giving every block context.

c1ek(m1IV),ciek(mici1) for i>1c_1 \leftarrow e_k(m_1 \oplus IV), \quad c_i \leftarrow e_k(m_i \oplus c_{i-1}) \text{ for } i > 1 m1dk(c1)IV,midk(ci)ci1 for i>1m_1 \leftarrow d_k(c_1) \oplus IV, \quad m_i \leftarrow d_k(c_i) \oplus c_{i-1} \text{ for } i > 1
  • A single ciphertext bit error corrupts its own plaintext block fully, plus a single bit in the next block, giving 1-block error propagation.
  • A fixed public IV (e.g. all-0) need not be transmitted. A random nonce IV must be sent alongside the ciphertext.

OFB

Output Feedback: runs the block cipher as a keystream generator, turning it into a stream cipher.

Yiek(Yi1),cimiYi,miciYiY_i \leftarrow e_k(Y_{i-1}), \quad c_i \leftarrow m_i \oplus Y_i, \quad m_i \leftarrow c_i \oplus Y_i

with Y0IVY_0 \leftarrow IV. Both encryption and decryption use eke_k, never dkd_k.

CFB

Cipher Feedback: also produces a keystream, but feeds the ciphertext itself back into the cipher input.

Ziek(Yi1),cimiZi,YiYi1ciZ_i \leftarrow e_k(Y_{i-1}), \quad c_i \leftarrow m_i \oplus Z_i^*, \quad Y_i \leftarrow Y_{i-1} \ll c_i

with Y0IVY_0 \leftarrow IV and ZiZ_i^* the leading bb bits of ZiZ_i. Decryption mirrors this using cic_i in place of mim_i.

CTR

Counter mode: like ECB, but XORs plaintext with the encryption of a counter rather than encrypting the plaintext directly.

cimiek(IVib),miciek(IVib)c_i \leftarrow m_i \oplus e_k(IV \oplus \langle i \rangle_b), \quad m_i \leftarrow c_i \oplus e_k(IV \oplus \langle i \rangle_b)

where ib\langle i \rangle_b is the bb-bit binary representation of ii.

  • Blocks can be encrypted in parallel, like ECB, since each block is independent.
  • The counter provides context, preventing the cut-and-paste and rearrangement attacks possible against ECB.
Was this helpful?