Aka. DES. Published in 1975 and standardized in 1977. Superseded by AES (1998/2001). The interactive guide to DES visualizes the Feistel rounds and key schedule.
DES is a Feistel cipher. It splits each block into 2 halves and runs a keyed round function many times, so the same structure encrypts and decrypts.
Design Parameters
- Block length bits.
- Number of rounds .
- Round function combining substitution and permutation.
- 16 round keys of 48 bits each, from a subkey generation algorithm.
- Secret key length 56 bits.
Permutation Tables
DES is built from fixed lookup tables. Every one is read the same way. Output bit is copied from the input bit whose position is the -th table entry.
- Reordering
A table that lists every input position exactly once drops and duplicates nothing. , , and are of this kind. - Expansion
A table longer than its input repeats some input positions. does this, listing 48 positions over a 32-bit input. - Compression
A table shorter than its input omits some positions. and do this, dropping key bits.
Substitution Boxes
An S-box maps 6 input bits to 4 output bits through a fixed table of 4 rows and 16 columns.
The outer 2 bits (first and last) select 1 of 4 rows. The middle 4 bits select 1 of 16 columns. The table entry at that row and column is the 4-bit output.
In DESm there are 8 S-boxes, and they all are different, fixed, and published in the standard. They are the only non-linear step in DES and the most security-critical component.
S-box 1:
| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| row | 14 | 4 | 13 | 1 | 2 | 15 | 11 | 8 | 3 | 10 | 6 | 12 | 5 | 9 | 0 | 7 |
| row | 0 | 15 | 7 | 4 | 14 | 2 | 13 | 1 | 10 | 6 | 12 | 11 | 9 | 5 | 3 | 8 |
| row | 4 | 1 | 14 | 8 | 13 | 6 | 2 | 11 | 15 | 12 | 9 | 7 | 3 | 10 | 5 | 0 |
| row | 15 | 12 | 8 | 2 | 4 | 9 | 1 | 7 | 5 | 11 | 3 | 14 | 10 | 0 | 6 | 13 |
Take input .
- Outer bits and give row .
- Middle bits give column .
- Row , column holds , so the output is .
Round Function
The round function takes a 32-bit half and the 48-bit round key , returning 32 bits. Round applies it to the previous round’s right half . It is computed in order.
Expansion Permutation
Expands the 32 input bits to 48 by the expansion table (). Split the 32 input bits into 8 consecutive groups of 4. Output block is group plus 1 bit borrowed from each side: the last bit of group in front, the first bit of group behind, wrapping at the ends. Each block is 6 bits and feeds 1 S-box.
- 1 32
- 2 1
- 3 2
- 4 3
- 5 4
- 6 5
- 7 4
- 8 5
- 9 6
- 10 7
- 11 8
- 12 9
- 13 8
- 14 9
- 15 10
- 16 11
- 17 12
- 18 13
- 19 12
- 20 13
- 21 14
- 22 15
- 23 16
- 24 17
- 25 16
- 26 17
- 27 18
- 28 19
- 29 20
- 30 21
- 31 20
- 32 21
- 33 22
- 34 23
- 35 24
- 36 25
- 37 24
- 38 25
- 39 26
- 40 27
- 41 28
- 42 29
- 43 28
- 44 29
- 45 30
- 46 31
- 47 32
- 48 1
Cell index is the output bit. Cell value is the input bit. Highlighted middle 4 columns are the group of 4. The unhighlighted first and last columns are the bits borrowed from the neighbouring groups.
Intermediate Steps
- Key mixing
XOR the 48-bit expanded value with the round key . - Split
Cut the 48-bit result into 8 blocks of 6 bits, one per S-box. - Substitution
Each S-box maps its 6-bit block to 4 bits, by the lookup defined above. - Combine
Concatenate the eight 4-bit outputs into 32 bits.
Permutation
Permute the 32 bits by the P-box. Each S-box output bit is scattered to a different S-box’s input group in the next round, so the 4 bits from one S-box never stay together.
- 1 16
- 2 7
- 3 20
- 4 21
- 5 29
- 6 12
- 7 28
- 8 17
- 9 1
- 10 15
- 11 23
- 12 26
- 13 5
- 14 18
- 15 31
- 16 10
- 17 2
- 18 8
- 19 24
- 20 14
- 21 32
- 22 27
- 23 3
- 24 9
- 25 19
- 26 13
- 27 30
- 28 6
- 29 22
- 30 11
- 31 4
- 32 25
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
Selects 56 bits from the 64-bit key, skipping the 8 parity bits, and permutes them. The first 28 outputs form , the last 28 form .
- 1 57
- 2 49
- 3 41
- 4 33
- 5 25
- 6 17
- 7 9
- 8 1
- 9 58
- 10 50
- 11 42
- 12 34
- 13 26
- 14 18
- 15 10
- 16 2
- 17 59
- 18 51
- 19 43
- 20 35
- 21 27
- 22 19
- 23 11
- 24 3
- 25 60
- 26 52
- 27 44
- 28 36
- 29 63
- 30 55
- 31 47
- 32 39
- 33 31
- 34 23
- 35 15
- 36 7
- 37 62
- 38 54
- 39 46
- 40 38
- 41 30
- 42 22
- 43 14
- 44 6
- 45 61
- 46 53
- 47 45
- 48 37
- 49 29
- 50 21
- 51 13
- 52 5
- 53 28
- 54 20
- 55 12
- 56 4
56 entries drawn from the 64-bit key. Positions 8, 16, 24, 32, 40, 48, 56, 64 (parity) never appear.
Rotation
Each round left-rotates and by positions to get , where is 1 or 2 as fixed by the schedule below.
and are 28-bit registers. The 16 shifts sum to 28, so a full left-rotation brings back to . Decryption uses this to walk the schedule backwards by right-rotating instead.
- 1 1
- 2 1
- 3 2
- 4 2
- 5 2
- 6 2
- 7 2
- 8 2
- 9 1
- 10 2
- 11 2
- 12 2
- 13 2
- 14 2
- 15 2
- 16 1
Cell index is the round number i. Cell value is pᵢ, the left-rotation amount for that round.
Permuted Choice 2
Rejoins into 56 bits, then selects and permutes 48 of them to produce round key . The 8 unused positions are 9, 18, 22, 25, 35, 38, 43, and 54.
- 1 14
- 2 17
- 3 11
- 4 24
- 5 1
- 6 5
- 7 3
- 8 28
- 9 15
- 10 6
- 11 21
- 12 10
- 13 23
- 14 19
- 15 12
- 16 4
- 17 26
- 18 8
- 19 16
- 20 7
- 21 27
- 22 20
- 23 13
- 24 2
- 25 41
- 26 52
- 27 31
- 28 37
- 29 47
- 30 55
- 31 30
- 32 40
- 33 51
- 34 45
- 35 33
- 36 48
- 37 44
- 38 49
- 39 39
- 40 56
- 41 34
- 42 53
- 43 46
- 44 42
- 45 50
- 46 36
- 47 29
- 48 32
48 entries over the 56-bit CᵢDᵢ. Output bit 1 takes bit 14 of CᵢDᵢ.
Encryption
DES encrypts one 64-bit block through 5 stages, using the 16 round keys from the key schedule and the round function .
Initial Permutation
Apply to the 64-bit input block, reordering all 64 bits.
- 1 58
- 2 50
- 3 42
- 4 34
- 5 26
- 6 18
- 7 10
- 8 2
- 9 60
- 10 52
- 11 44
- 12 36
- 13 28
- 14 20
- 15 12
- 16 4
- 17 62
- 18 54
- 19 46
- 20 38
- 21 30
- 22 22
- 23 14
- 24 6
- 25 64
- 26 56
- 27 48
- 28 40
- 29 32
- 30 24
- 31 16
- 32 8
- 33 57
- 34 49
- 35 41
- 36 33
- 37 25
- 38 17
- 39 9
- 40 1
- 41 59
- 42 51
- 43 43
- 44 35
- 45 27
- 46 19
- 47 11
- 48 3
- 49 61
- 50 53
- 51 45
- 52 37
- 53 29
- 54 21
- 55 13
- 56 5
- 57 63
- 58 55
- 59 47
- 60 39
- 61 31
- 62 23
- 63 15
- 64 7
Cell index is the output bit. Cell value is the input bit it copies. Output bit 1 takes input bit 58.
Split
Take the first 32 permuted bits as , the last 32 as . Reading the entries, every even-positioned input bit lands in and every odd-positioned bit lands in .
Feistel Rounds
Run 16 rounds. Round sets and .
Rejoin
Concatenate as , halves swapped, into a 64-bit block. The swap makes decryption run the exact same steps as encryption.
Final Permutation
Apply to produce the ciphertext block. It is the exact inverse of . Input bit 58 sits at position 1 after , so has 58 as its 40th entry, sending it back. Applying it after the rounds cancels the initial reordering.
- 1 40
- 2 8
- 3 48
- 4 16
- 5 56
- 6 24
- 7 64
- 8 32
- 9 39
- 10 7
- 11 47
- 12 15
- 13 55
- 14 23
- 15 63
- 16 31
- 17 38
- 18 6
- 19 46
- 20 14
- 21 54
- 22 22
- 23 62
- 24 30
- 25 37
- 26 5
- 27 45
- 28 13
- 29 53
- 30 21
- 31 61
- 32 29
- 33 36
- 34 4
- 35 44
- 36 12
- 37 52
- 38 20
- 39 60
- 40 28
- 41 35
- 42 3
- 43 43
- 44 11
- 45 51
- 46 19
- 47 59
- 48 27
- 49 34
- 50 2
- 51 42
- 52 10
- 53 50
- 54 18
- 55 58
- 56 26
- 57 33
- 58 1
- 59 41
- 60 9
- 61 49
- 62 17
- 63 57
- 64 25
Decryption
DES decrypts with the exact same algorithm and tables, feeding the round keys in reverse order .
The Feistel round is invertible no matter what computes. Given and , the previous half is recovered as . The final half-swap on the encryption side lines the ciphertext up so the same round formula runs unchanged.
The round keys in reverse come for free from the schedule. Right-rotating by the same schedule regenerates from without re-running PC-1.
Security Properties
- Avalanche effect
A single plaintext bit difference should flip about 50% of ciphertext bits. feeds 16 of the 32 half-bits into 2 S-boxes each, and scatters each S-box’s 4 output bits into different S-boxes in the next round, so a local change spreads fast. - Key size
56 bits is the reason DES fell. A brute-force search averages steps, feasible on dedicated hardware such as the EFF Deep Crack machine in 1998. - S-box strength
The S-boxes were chosen to resist differential cryptanalysis, a technique not public until 1990.
Variations
Double DES
Encrypting twice with the same key, , adds no strength. The single 56-bit key is still found by brute force in steps on average. DES is not a group, so the double encryption is not equal to a single DES under some other key. That rules out a trivial break but does not enlarge the key.
Double DES with 2 Keys
with 2 independent 56-bit keys. The key space is 112 bits, but the meet-in-the-middle attack inverts the 2 layers separately and cuts the effective strength to about .
Triple DES (3DES)
, effective key length 168 bits. The middle step is a decryption so that setting makes 3DES compute plain DES. 3DES hardware then stays interoperable with single-DES peers.
2-Key 3DES
Setting gives , effective key length 112 bits. The 3 forms are the standard keying options. 3 independent keys is option 1, is option 2, all keys equal is option 3. NIST has since deprecated 3DES in favour of AES.
Why Not Extend DES
3DES already composed DES instead of redesigning it. 3 problems remained.
- Block size
Still 64 bits. Birthday-bound collisions appear after about blocks under 1 key, no matter the key length. - Composition loss
Double DES’s 112-bit key space drops to about effective strength under a meet-in-the-middle attack. Reaching close to the nominal strength needs the full 3-stage 3DES structure. - Speed
3DES runs the DES round function 3 times per block, on top of DES already being tuned for 1970s hardware rather than software.
Widening DES’s key or block does not inherit its security margin. The margin comes from the specific interaction between the 16 rounds, the Feistel structure, and the 6-bit S-boxes, not from a formula that scales with the numbers. Changing any of those needs the same fresh cryptanalysis a new cipher would. NIST ran an open competition instead, which also settled decades of suspicion around the NSA’s undisclosed role in choosing the original S-boxes.
Attacking DES
A brute-force known-plaintext attack averages steps given the 56-bit key.
Meet in the Middle Attack
A known-plaintext attack. Breaks a double encryption whose 2 layers can be inverted independently. Trades storage for time instead of searching all key pairs.
- Take one known plaintext-ciphertext pair .
- For every key , compute and store in a table.
- For every key , compute and look up in the table.
- Each hit gives a candidate pair that agrees at the midpoint.
- Test surviving candidates against a second known pair to drop false matches.
Take -bit keys. The first loop runs encryptions and fills a table of entries. The second loop runs decryptions. The total is cipher calls, with storage for the table. Brute force instead tries every pair, calls, with no storage. For double DES , so the work drops from to roughly .
Linear Cryptanalysis
A known-plaintext attack, published by Matsui in 1993.
Notation. is bit of the plaintext, bit of the ciphertext, bit of the key. is XOR taken over a chosen set of positions: in the plaintext, in the ciphertext, in the key. XOR of a set of bits is 1 when an odd number of them are 1, so each side of the equation is the parity of its selected bits.
A linear approximation claims these 2 parities are equal:
The left side is built only from bits the attacker can see. The right side is 1 fixed bit, the parity of some unknown key bits. It never changes, since the key is fixed.
Example. With , , the equation reads
For a random pair the left side is 0 half the time and 1 half the time, so it says nothing about the right side. The DES S-boxes are slightly unbalanced, so for a well-chosen the left side equals the right side with probability for some bias .
- Collect known pairs .
- Compute the left side of each.
- If the left side is 0 in more than half the pairs, the fixed right side is 0, otherwise 1.
That recovers 1 bit of information about the key, the parity in the example. The answer is right with confidence that grows in , needing about pairs. Enough different equations pin down enough key-bit parities to solve for the key. Full DES falls to about known pairs, below brute force but far more plaintext than an attacker usually holds.
Differential Cryptanalysis
A chosen-plaintext attack, made public by Biham and Shamir around 1990.
Works with the XOR difference of a plaintext pair , not the values. Fix an input difference and follow the difference forward through the rounds.
- The linear steps , , , satisfy . Their output difference is a fixed function of the input difference, free of the actual values and of the key.
- An S-box is not linear. For a given input difference its output difference is not fixed, but some output differences are far more likely than others. The difference distribution table counts, for each pair of input and output differences, how many of the 64 input pairs produce it.
Chaining high-probability S-box differences across rounds gives a characteristic. This is a predicted difference through the first 15 rounds that holds with some probability .
- Encrypt many plaintext pairs with input difference .
- For each guess of the last round key feeding the active S-boxes, undo the last round and check whether the round-15 difference matches the characteristic.
- The correct guess matches at rate , wrong guesses at the lower random rate. The guess with the most matches is the key.
The pair difference never depends on , since XORing the pair cancels the equal round-key terms. Full DES needs about chosen plaintexts. The S-boxes were tuned in 1974 to resist exactly this, so the attack does not threaten DES in practice.