DES

DES is a block cipher system. The key length is 56 bits, and the block size is 64 bits. The system consists of a permutation $\text{IP}$ on 64 bits with the inverse $\text{IP}^{-1}$, and a function $f$ which will take an input of a pair $(R,K)$ and make a ouput $M$ where $R$ and $M$ are 32 bit streams, while $K$ is a key of 48 bits.

The steps to encipher a message is as following:

  1. Use the 56 bit key to generate a sequence of 16 keys, each of 48 bits. Let them be $K_1$, $\dots$, $K_{16}$. This is a standard procedure.
  2. Take a block of plaintext $P$ (64 bits). Apply $\text{IP}$ to it and break the image into two parts. The first 32 bits is denoted as $R_{-1}$, and the last 32 bits $R_0$.
  3. Take $R_0$ and compute $M_0=f(R_0,K_1)$, and then get $R_1=M_0\mathbin{\text{xor}} R_{-1}$.
  4. Take $R_1$ and compute $M_1=f(R_1,K_2)$, and then get $R_2=M_1\mathbin{\text{xor}} R_{0}$.
  5. Take $R_2$ and compute $M_2=f(R_2,K_3)$, and then get $R_3=M_2\mathbin{\text{xor}} R_{1}$.
  6. Repeat the process for all 16 keys, i.e., take $R_{i-1}$ and compute $M_{i-1}=f(R_{i-1},K_{i})$, and then get $R_{i}=M_{i-1}\mathbin{\text{xor}} R_{i-2}$, $i=1,2,\dots,16$.
  7. Finally, apply $\text{IP}^{-1}$ to the concatenation $R_{16}+R_{15}$ to get the ciphertext $C$.

To decipher $C$, use the same key and the same procedure but use the keys $K_i$ in the reversed order (so to "encipher" $C$ but with the keys used in a reversed order):

  1. Use the 56 bit key to generate the 16 keys, $K_1$, $\dots$, $K_{16}$.
  2. Apply $\text{IP}$ to $C$. The stream $R_{16}+R_{15}$ of 64 bits reveals.
  3. Take $R_{15}$ and compute $M_{15}=f(R_{15},K_{16})$, and then $M_{15}\mathbin{\text{xor}} R_{16}=M_{15}\mathbin{\text{xor}} (M_{15}\mathbin{\text{xor}} R_{14})=R_{14}$.
  4. Take $R_{14}$ and compute $M_{14}=f(R_{14},K_{15})$, and then $M_{14}\mathbin{\text{xor}} R_{15}=M_{14}\mathbin{\text{xor}} (M_{14}\mathbin{\text{xor}} R_{13})=R_{13}$.
  5. Repeat this process for all 16 keys, i.e., compute $M_{i-1}=f(R_{i-1},K_{i})$, and then get $M_{i-1}\mathbin{\text{xor}} R_{i}=M_{i-1}\mathbin{\text{xor}} (M_{i-1}\mathbin{\text{xor}} R_{i-2})=R_{i-2}$, $i=16,15,\dots,1$.
  6. When $i=1$, $R_0$ and $R_{-1}$ are at our hand. An application of $\text{IP}^{-1}$ to the concatenation $R_{-1}+R_0$ will give us $P$.