Notation: DES accepts a 64-bit key representation with eight parity bits, leaving 56 effective key bits; each round key has 48 bits. Three-key 3DES has 168 nominal key bits but roughly 112-bit security. DES and 3DES are retained here as historical teaching examples.
Algorithm-transition context: NIST SP 800-131A Rev. 2
Block ciphers, such as DES, 3DES, and AES, are widely used symmetric encryption algorithms, processing plaintext input in fixed-size blocks, producing equal-sized ciphertext blocks.
Data Encryption Standard (DES)
Uses 64-bit plaintext and 56-bit keys, with 16 rounds of processing.
The plaintext is 64 bits in length and the key is 56 bits in length. Longer plaintext amounts are processed in 64-bit blocks. There are 16 rounds of processing. From the original 56-bit key, 16 subkeys are generated, one of which is used for each round. The process of decryption with DES is the same as the encryption, Use the ciphertext as input to the DES algorithm, but use the subkeys Ki in reverse order.
Triple DES
3DES uses three keys and three executions of the DES algorithm. The function follows an encrypt-decrypt-encrypt (EDE) sequence

Decryption is with keys reversed
Three-key 3DES has 168 nominal key bits and roughly 112-bit security
Confusion
(Principle introduced by Claude shannon)
Aims to mask relationship between encryption and ciphertext to make it difficult for attacker to perform cryptanalysis
Diffusion
Spreads influence of each plaintext bit across multiple ciphertext bits to make patterns in plaintext less noticeable. (small change in plaintext results in huge changes in ciphertext)
Data Encryption Standard (DES)
Adopted by NIST in 1977
Symmetric block cipher
Input: 64 bits
Output: 64 bits
Main key: 64 bits
Sub key: 56 bits
Round key: 48 bits
No of rounds: 16
DES is criticized for key length too short
Whole process:
Initial permutation:
DES initial permutation
Original input bit positions:
| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
| 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |
| 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 |
| 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 |
| 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 |
| 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 |
| 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 |
| 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 |
Output selects input positions in this order:
| 58 | 50 | 42 | 34 | 26 | 18 | 10 | 2 |
| 60 | 52 | 44 | 36 | 28 | 20 | 12 | 4 |
| 62 | 54 | 46 | 38 | 30 | 22 | 14 | 6 |
| 64 | 56 | 48 | 40 | 32 | 24 | 16 | 8 |
| 57 | 49 | 41 | 33 | 25 | 17 | 9 | 1 |
| 59 | 51 | 43 | 35 | 27 | 19 | 11 | 3 |
| 61 | 53 | 45 | 37 | 29 | 21 | 13 | 5 |
| 63 | 55 | 47 | 39 | 31 | 23 | 15 | 7 |
The first DES round

After the initial permutation, split the 64-bit input into L₀ and R₀. Expand R₀ from 32 to 48 bits, XOR with K₁, apply eight S-boxes to return to 32 bits, and apply P. Then L₁ = R₀ and R₁ = L₀ XOR F(R₀, K₁). The same structure repeats for 16 rounds.
Final permutation
/ Inverse permutation
DES inverse initial permutation
| 40 | 8 | 48 | 16 | 56 | 24 | 64 | 32 |
| 39 | 7 | 47 | 15 | 55 | 23 | 63 | 31 |
| 38 | 6 | 46 | 14 | 54 | 22 | 62 | 30 |
| 37 | 5 | 45 | 13 | 53 | 21 | 61 | 29 |
| 36 | 4 | 44 | 12 | 52 | 20 | 60 | 28 |
| 35 | 3 | 43 | 11 | 51 | 19 | 59 | 27 |
| 34 | 2 | 42 | 10 | 50 | 18 | 58 | 26 |
| 33 | 1 | 41 | 9 | 49 | 17 | 57 | 25 |
Single round of DES algorithm

Expansion Permutation
DES expansion: 32 bits to 48 bits
Arrange the 32 input positions into eight groups of four:
| 1 | 2 | 3 | 4 |
| 5 | 6 | 7 | 8 |
| 9 | 10 | 11 | 12 |
| 13 | 14 | 15 | 16 |
| 17 | 18 | 19 | 20 |
| 21 | 22 | 23 | 24 |
| 25 | 26 | 27 | 28 |
| 29 | 30 | 31 | 32 |
Duplicate boundary bits to obtain eight groups of six:
| 32 | 1 | 2 | 3 | 4 | 5 |
| 4 | 5 | 6 | 7 | 8 | 9 |
| 8 | 9 | 10 | 11 | 12 | 13 |
| 12 | 13 | 14 | 15 | 16 | 17 |
| 16 | 17 | 18 | 19 | 20 | 21 |
| 20 | 21 | 22 | 23 | 24 | 25 |
| 24 | 25 | 26 | 27 | 28 | 29 |
| 28 | 29 | 30 | 31 | 32 | 1 |
New expanded block 32 → 48
F is the mangler Function

Keyed Substitution
BOX
S-boxes in DES provide non-linearity in encryption, creating confusion in ciphertext and making it more secure.
DES S₁ substitution table
| Row / column | 0000 | 0001 | 0010 | 0011 | 0100 | 0101 | 0110 | 0111 | 1000 | 1001 | 1010 | 1011 | 1100 | 1101 | 1110 | 1111 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 00 | 14 | 4 | 13 | 1 | 2 | 15 | 11 | 8 | 3 | 10 | 6 | 12 | 5 | 9 | 0 | 7 |
| 01 | 0 | 15 | 7 | 4 | 14 | 2 | 13 | 1 | 10 | 6 | 12 | 11 | 9 | 5 | 3 | 8 |
| 10 | 4 | 1 | 14 | 8 | 13 | 6 | 2 | 11 | 15 | 12 | 9 | 7 | 3 | 10 | 5 | 0 |
| 11 | 15 | 12 | 8 | 2 | 4 | 9 | 1 | 7 | 5 | 11 | 3 | 14 | 10 | 0 | 6 | 13 |
The outer two input bits select the row; the middle four bits select the column. For 101010, the row is 10 and the column is 0101, giving 6 = 0110. The source screenshot has a typo at row 01, column 1100; the DES value is 9.
DES tables: FIPS 46-3 (historical standard)
S-boxes
Transposition / Permutation Function (P Box)
DES P permutation
| 16 | 7 | 20 | 21 | 29 | 12 | 28 | 17 |
| 1 | 15 | 23 | 26 | 5 | 18 | 31 | 10 |
| 2 | 8 | 24 | 14 | 32 | 27 | 3 | 9 |
| 19 | 13 | 30 | 6 | 22 | 11 | 4 | 25 |
Permutation involves rearranging input bits, distributing the influence of each bit, ensuring that a small change in input affects multiple bits in the output. Carries out diffusion process
Key scheduling in DES
Idea is to take original 56-bit key and derive a different keys to use at each encryption round.
Ensures that encryption process uses different keys in each round

S-boxes introduce confusion through nonlinearity. P-boxes distribute bit influence and contribute to diffusion across rounds. After 16 Feistel rounds, DES is intended to behave like a pseudorandom keyed permutation of the plaintext.
| 56-bit key is permuted using a table called PC-1 , which rearranges the bits and discards 8 of the parity bits, leaving the key as a 56-bit value. The result is divided into two halves: a left half (C0) and a right half (D0) , each with 28 bits. |
= 1 left shift for i: 1, 2, 9, 16 = 2 left shift for i: other rounds
| The PC-2 table is then used to permute this combined 56-bit key, selecting 48 bits to form the subkey for that particular round. |
DES Decryption
Since DES is a symmetric key algorithm, the same key is used for both encryption and decryption.

How can we so easily decrypt DES algorithm?
- Symmetric key algorithm, same key for encryption and decryption
in decryption round 1, subkey 16 needed
in decryption round 2, subkey 15 needed
in decryption round 3, subkey 14 needed - Uses Feistel structure, which allows encryption and decryption to use same operations with only difference of order of subkeys
- Uses initial permutation and final permutation that are inverses of each other, so applying final permutation during decryption reverses the initial permutation during encryption
Avalanche effect and strength of DES
Is a desirable property in cryptographic algorithms, where a small input change significantly alters the output, ideally changing half of the bits.
DES has a very strong avalanche effect
1 bit change in plain text - 34 bits change in cipher text on average
1 bit change in cipher text - 34 bits change in plain text on average
Advanced Encryption Standard (AES) (20.3)
NIST in 2001
Symmetric block cipher 128 bit blocks
Supports three key sizes:
128-bit key = 10 rounds
192-bit key = 12 rounds
256-bit key = 14 rounds


AES Transformation Functions
- Substitute Bytes
It is responsible for introducing non-linearity into the encryption process

- Shift Rows
primary purpose is to provide diffusion. function operates on the state matrix, which is a 4x4 array of bytes
Row 0: No shift.
Row 1: Left shift by 1 byte.
Row 2: Left shift by 2 bytes.
Row 3: Left shift by 3 bytes.

- Mix Columns
purpose is to increase diffusion
Each column in state matrix is matmul by fixed matrix

- Add Round Key

AES Key expansion
1 word = 4 bytes
AES-128 round-key words
| Round | Key words |
|---|---|
| Initial key | w0, w1, w2, w3 |
| 1 | w4, w5, w6, w7 |
| 2 | w8, w9, w10, w11 |
| 3 | w12, w13, w14, w15 |
| 4 | w16, w17, w18, w19 |
| 5 | w20, w21, w22, w23 |
| 6 | w24, w25, w26, w27 |
| 7 | w28, w29, w30, w31 |
| 8 | w32, w33, w34, w35 |
| 9 | w36, w37, w38, w39 |
| 10 | w40, w41, w42, w43 |

S-Box in AES
AES S-box
| Row / column | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | 63 | 7C | 77 | 7B | F2 | 6B | 6F | C5 | 30 | 01 | 67 | 2B | FE | D7 | AB | 76 |
| 1 | CA | 82 | C9 | 7D | FA | 59 | 47 | F0 | AD | D4 | A2 | AF | 9C | A4 | 72 | C0 |
| 2 | B7 | FD | 93 | 26 | 36 | 3F | F7 | CC | 34 | A5 | E5 | F1 | 71 | D8 | 31 | 15 |
| 3 | 04 | C7 | 23 | C3 | 18 | 96 | 05 | 9A | 07 | 12 | 80 | E2 | EB | 27 | B2 | 75 |
| 4 | 09 | 83 | 2C | 1A | 1B | 6E | 5A | A0 | 52 | 3B | D6 | B3 | 29 | E3 | 2F | 84 |
| 5 | 53 | D1 | 00 | ED | 20 | FC | B1 | 5B | 6A | CB | BE | 39 | 4A | 4C | 58 | CF |
| 6 | D0 | EF | AA | FB | 43 | 4D | 33 | 85 | 45 | F9 | 02 | 7F | 50 | 3C | 9F | A8 |
| 7 | 51 | A3 | 40 | 8F | 92 | 9D | 38 | F5 | BC | B6 | DA | 21 | 10 | FF | F3 | D2 |
| 8 | CD | 0C | 13 | EC | 5F | 97 | 44 | 17 | C4 | A7 | 7E | 3D | 64 | 5D | 19 | 73 |
| 9 | 60 | 81 | 4F | DC | 22 | 2A | 90 | 88 | 46 | EE | B8 | 14 | DE | 5E | 0B | DB |
| A | E0 | 32 | 3A | 0A | 49 | 06 | 24 | 5C | C2 | D3 | AC | 62 | 91 | 95 | E4 | 79 |
| B | E7 | C8 | 37 | 6D | 8D | D5 | 4E | A9 | 6C | 56 | F4 | EA | 65 | 7A | AE | 08 |
| C | BA | 78 | 25 | 2E | 1C | A6 | B4 | C6 | E8 | DD | 74 | 1F | 4B | BD | 8B | 8A |
| D | 70 | 3E | B5 | 66 | 48 | 03 | F6 | 0E | 61 | 35 | 57 | B9 | 86 | C1 | 1D | 9E |
| E | E1 | F8 | 98 | 11 | 69 | D9 | 8E | 94 | 9B | 1E | 87 | E9 | CE | 55 | 28 | DF |
| F | 8C | A1 | 89 | 0D | BF | E6 | 42 | 68 | 41 | 99 | 2D | 0F | B0 | 54 | BB | 16 |
Use the high hexadecimal nibble as the row and the low nibble as the column. For C2, row C and column 2 contain 25.
AES-128 round constants
| Round | Rcon word |
|---|---|
| 1 | 01000000 |
| 2 | 02000000 |
| 3 | 04000000 |
| 4 | 08000000 |
| 5 | 10000000 |
| 6 | 20000000 |
| 7 | 40000000 |
| 8 | 80000000 |
| 9 | 1B000000 |
| 10 | 36000000 |
The initial round uses the original key directly. The source labels its round constant 00000000; no round-constant transformation is needed for that initial key.
Decryption in AES
Whats different:
- Inverse transformation
uses inverse AES S-Box
Inverse AES S-box
| Row / column | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | 52 | 09 | 6A | D5 | 30 | 36 | A5 | 38 | BF | 40 | A3 | 9E | 81 | F3 | D7 | FB |
| 1 | 7C | E3 | 39 | 82 | 9B | 2F | FF | 87 | 34 | 8E | 43 | 44 | C4 | DE | E9 | CB |
| 2 | 54 | 7B | 94 | 32 | A6 | C2 | 23 | 3D | EE | 4C | 95 | 0B | 42 | FA | C3 | 4E |
| 3 | 08 | 2E | A1 | 66 | 28 | D9 | 24 | B2 | 76 | 5B | A2 | 49 | 6D | 8B | D1 | 25 |
| 4 | 72 | F8 | F6 | 64 | 86 | 68 | 98 | 16 | D4 | A4 | 5C | CC | 5D | 65 | B6 | 92 |
| 5 | 6C | 70 | 48 | 50 | FD | ED | B9 | DA | 5E | 15 | 46 | 57 | A7 | 8D | 9D | 84 |
| 6 | 90 | D8 | AB | 00 | 8C | BC | D3 | 0A | F7 | E4 | 58 | 05 | B8 | B3 | 45 | 06 |
| 7 | D0 | 2C | 1E | 8F | CA | 3F | 0F | 02 | C1 | AF | BD | 03 | 01 | 13 | 8A | 6B |
| 8 | 3A | 91 | 11 | 41 | 4F | 67 | DC | EA | 97 | F2 | CF | CE | F0 | B4 | E6 | 73 |
| 9 | 96 | AC | 74 | 22 | E7 | AD | 35 | 85 | E2 | F9 | 37 | E8 | 1C | 75 | DF | 6E |
| A | 47 | F1 | 1A | 71 | 1D | 29 | C5 | 89 | 6F | B7 | 62 | 0E | AA | 18 | BE | 1B |
| B | FC | 56 | 3E | 4B | C6 | D2 | 79 | 20 | 9A | DB | C0 | FE | 78 | CD | 5A | F4 |
| C | 1F | DD | A8 | 33 | 88 | 07 | C7 | 31 | B1 | 12 | 10 | 59 | 27 | 80 | EC | 5F |
| D | 60 | 51 | 7F | A9 | 19 | B5 | 4A | 0D | 2D | E5 | 7A | 9F | 93 | C9 | 9C | EF |
| E | A0 | E0 | 3B | 4D | AE | 2A | F5 | B0 | C8 | EB | BB | 3C | 83 | 53 | 99 | 61 |
| F | 17 | 2B | 04 | 7E | BA | 77 | D6 | 26 | E1 | 69 | 14 | 63 | 55 | 21 | 0C | 7D |
- Inverse Shiftrows
the rows that were shifted left in encryption are now shifted right using Inverse ShiftRows.
Inverse ShiftRows
| Row | Before | After right rotation |
|---|---|---|
| 0 | B0 B4 B8 B12 | B0 B4 B8 B12 |
| 1 | B1 B5 B9 B13 | B13 B1 B5 B9 |
| 2 | B2 B6 B10 B14 | B10 B14 B2 B6 |
| 3 | B3 B7 B11 B15 | B7 B11 B15 B3 |
Rows 0, 1, 2, and 3 rotate right by 0, 1, 2, and 3 positions, respectively.
- Inverse Mix Columns
Inverse of mix columns is matmul to reverse mixing of columns during encryption
MixColumns and its inverse
Entries are hexadecimal bytes; multiplication and addition take place in GF(2⁸), not ordinary integer arithmetic.
- Add Round Key
Operation is identical but order in which round keys is in reverse order like DES
- Order of operations
in encryption order of transformations is: - SubBytes
- ShiftRows
- MixColumns
- AddRoundKey
in decryption order of transformations is:
- AddRoundKey
- Inverse ShiftRows
- Inverse SubBytes
- Inverse MixColumns