Block Ciphers and DES

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

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

A block cipher operates on a fixed-length block of plaintext mm of nn bits, mapping it to a ciphertext block cc of the same length under a secret key kk, both drawn from {0,1}n\{0,1\}^n.

For a fixed key kk, the encryption function eke_k is a bijection on {0,1}n\{0,1\}^n, so it is invertible via dkd_k.

Block Cipher as a PRP

A block cipher’s key design objective is to behave like a family of pseudorandom permutations (PRP) indexed by kk.

Large messages are divided into blocks and encrypted independently per block:

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

Per Kerckhoffs’s principle, ee and dd are public. Only kk is secret.

Attacking a Block Cipher

  • Ciphertext only
    Attacker has only cc and searches the key space exhaustively for a kk giving a meaningful dk(c)d_k(c). Requires K>264|K| > 2^{64} to make this infeasible.
  • Chosen plaintext (IND-CPA)
    Attacker submits chosen plaintexts to an encryption oracle and must not be able to distinguish encryptions of chosen messages better than a coin toss.
  • Chosen ciphertext (IND-CCA)
    Attacker has access to an encryption oracle, a decryption oracle (except for the challenge ciphertext), and a left-right oracle producing c=ek(mb)c^* = e_k(m_b) for b{0,1}b \in \{0,1\}. Wins by guessing bb. A secure scheme limits this to probability 0.5.

A block cipher is only a building block. The specific design combining a block cipher into a usable encryption scheme is its mode of operation.

Iterated Block Cipher Design

Security comes from repeated application of a round function to the block, over rr rounds. Increasing rr increases security up to a stable level.

Feistel Cipher

Named after Horst Feistel. Splits the plaintext block into halves (L0,R0)(L_0, R_0) and iterates a round function FF, keyed by kik_i, over rr rounds, swapping the final halves to produce the ciphertext.

Each encryption round:

LiRi1,RiLi1F(ki,Ri1)L_i \leftarrow R_{i-1}, \quad R_i \leftarrow L_{i-1} \oplus F(k_i, R_{i-1})

Each decryption round, using the round keys in reverse order:

Ri1Li,Li1RiF(ki,Li)R_{i-1} \leftarrow L_i, \quad L_{i-1} \leftarrow R_i \oplus F(k_i, L_i)

Design parameters of a Feistel cipher:

  • Block length nn.
  • Number of rounds rr.
  • Definition of the round function FF.
  • Key schedule generating each round key kik_i from kk.
  • Length of the secret key kk.

DES

The Data Encryption Standard, published 1975, standardized 1977. Superseded by AES (1998/2001).

Design parameters:

  • Block length n=64n = 64 bits.
  • Number of rounds r=16r = 16.
  • Round function combining substitution and permutation.
  • 16 round keys of 48 bits each, from a subkey generation algorithm.
  • Secret key length 56 bits.

Attacking DES

A brute-force known-plaintext attack averages 2552^{55} steps given the 56-bit key.

Double and Triple DES

  • Double DES
    Encrypting twice with the same key (c2=Ek(Ek(m))c_2 = E_k(E_k(m))) is broken by the meet-in-the-middle attack, which encrypts mm forward and decrypts c2c_2 backward over all keys, matching where results agree, in 2562^{56} steps.
  • Double DES with 2 keys
    c2=Ek2(Ek1(m))c_2 = E_{k_2}(E_{k_1}(m)) gives an effective key length of 112 bits.
  • Triple DES (3DES)
    c=Ek3(Dk2(Ek1(m)))c = E_{k_3}(D_{k_2}(E_{k_1}(m))), effective key length 168 bits. Setting k1=k2=k3k_1 = k_2 = k_3 reduces it to plain DES.
  • 2-key 3DES
    Setting k1=k3k_1 = k_3 gives c=Ek1(Dk2(Ek1(m)))c = E_{k_1}(D_{k_2}(E_{k_1}(m))), effective key length 112 bits.

Internal Structure of DES

  1. Initial permutation (IP) of the 64-bit input block.
  2. Split into left and right halves.
  3. 16 Feistel rounds.
  4. Rejoin the halves.
  5. Final inverse permutation (IP1IP^{-1}).

Round Function

Per round, the 32-bit right half is processed:

  1. Expansion permutation EE, 32 bits to 48 bits.
  2. XOR with the 48-bit round key.
  3. Split into 8 blocks of 6 bits.
  4. Substitution via 8 S-boxes, each 6-bit input to a 4-bit output.
  5. Combine the 8 outputs into 32 bits.
  6. Permutation via the P-box.
  • Expansion permutation
    Diffuses input bits. The first and last bits of each 6-bit S-box input select a row (of 4) in that S-box, and the middle 4 bits select a column (of 16).
  • Avalanche effect
    16 of the 32 input bits each affect both a row and column selection across 2 different S-boxes, spreading dependencies. A single plaintext bit difference should flip about 50% of ciphertext bits.
  • S-boxes
    Provide the cipher’s non-linearity, the most security-critical component of DES.

Key Schedule

The 64-bit input key has every 8th bit as a parity bit, so the effective key length is 56 bits.

  • Permuted Choice 1 (PC-1)
    Permutes the 56-bit key, splitting the result into two 28-bit halves C0,D0C_0, D_0.
  • Rotation
    Each round left-rotates Ci1C_{i-1} and Di1D_{i-1} by pip_i positions (1 or 2, per a fixed schedule) to get Ci,DiC_i, D_i.
  • Permuted Choice 2 (PC-2)
    Rejoins Ci,DiC_i, D_i into 56 bits, drops 8 fixed bit positions, and permutes the remaining 48 bits to produce round key kik_i.
Was this helpful?