After completing this tutorial, you should be able to:
The Data Encryption Standard (DES) is one of the most historically significant cryptographic algorithms. Developed in the 1970s and adopted as a federal standard in 1977, DES was the first publicly available encryption standard and became the de facto standard for commercial and government encryption for nearly two decades. Its design introduced the Feistel network to the wider cryptographic community and set the stage for modern block cipher design.
Despite its eventual replacement by the Advanced Encryption Standard (AES), DES remains important for several reasons: it provides a clear example of a Feistel cipher; its cryptanalysis (differential and linear) advanced the field significantly; and its successor, Triple DES, is still in use in legacy systems. Understanding DES gives you a concrete understanding of how symmetric block ciphers are constructed and analyzed.
In this tutorial, we dissect DES in detail: from its historical origins and design principles to its internal structure—the initial permutation, the 16 Feistel rounds, the key schedule, and the S-boxes. We then examine its security, including the 56-bit key space, weak keys, and known attacks. Finally, we discuss Triple DES (3DES), which extended DES's life by increasing the key length, and the reasons for its eventual deprecation.
In Tutorial 2.4, we introduced symmetric encryption fundamentals, including the Feistel structure. This tutorial brings that structure to life with a specific algorithm. Tutorial 2.6 will cover AES, the successor to DES, allowing you to compare the two important standards. Understanding DES also provides context for block cipher modes (Tutorial 2.7) and key management (Tutorial 2.8).
In 1973, the U.S. National Bureau of Standards (NBS, now NIST) issued a public call for an encryption algorithm to serve as a national standard. IBM submitted a cipher called Lucifer, designed by Horst Feistel. After modifications by IBM and the National Security Agency (NSA), the algorithm was adopted as the Data Encryption Standard in 1977 (FIPS 46). The modifications included a reduction in key size from 128 bits to 56 bits (to fit on a single chip) and changes to the S-boxes.
Controversy: The NSA's involvement in the design of the S-boxes raised concerns of a "trapdoor" that would allow the NSA to decrypt messages. These suspicions were later allayed when researchers discovered that the S-boxes were specifically designed to resist differential cryptanalysis—a technique that was not publicly known at the time but was apparently known to the NSA/IBM team. This illustrates the principle of designing ciphers to resist future attacks.
DES was the first commercial-grade cipher to be standardized and was widely adopted in banking, finance, and government (for unclassified data). In 1998, FIPS 46-3 reaffirmed DES, but also specified Triple DES (3DES) as a stronger alternative.
DES operates on 64-bit blocks of plaintext, producing 64-bit ciphertext blocks under the control of a 56-bit key. The algorithm consists of an initial permutation (IP), 16 rounds of a Feistel network, and a final inverse permutation (IP−1). The key is used to derive 16 round keys, one for each round.
Figure 1: Overall DES encryption process.
As described in Tutorial 2.4, a Feistel cipher splits the block into two halves (L and R) and applies the round function to one half, XORing the result with the other half. DES follows this structure precisely.
After the initial permutation, the 64-bit block is split into a 32-bit left half (L0) and a 32-bit right half (R0). For each of the 16 rounds, the following operations are performed:
Li = Ri−1 Ri = Li−1 ⊕ F(Ri−1, Ki)
where Ki is the 48-bit round key for round i, and F is the round function (described below). After the 16th round, the final swap is performed (L16 and R16 are not swapped; they are passed as is to the inverse permutation).
Figure 2: One round of DES (round i).
The DES key schedule takes the 64-bit key (including 8 parity bits) and generates 16 round keys, each of 48 bits. The steps are:
The PC-1 and PC-2 tables are fixed and standardized. The shift schedule is:
| Round | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Left shifts | 1 | 1 | 2 | 2 | 2 | 2 | 2 | 2 | 1 | 2 | 2 | 2 | 2 | 2 | 2 | 1 |
The round function F takes a 32-bit input (the right half R) and a 48-bit round key K, and produces a 32-bit output. It consists of four steps:
The output of the P-box is the output of F, which is then XORed with the left half.
The S-boxes are the heart of DES's security. They are the only non-linear component, providing confusion. Each S-box is a lookup table with 4 rows (2 bits) and 16 columns (4 bits). The 6-bit input selects a row (using the first and last bits) and a column (using the middle four bits), and the output is the 4-bit value at that cell.
For example, S1 is defined as:
| Row\Col | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | 14 | 4 | 13 | 1 | 2 | 15 | 11 | 8 | 3 | 10 | 6 | 12 | 5 | 9 | 0 | 7 |
| 1 | 0 | 15 | 7 | 4 | 14 | 2 | 13 | 1 | 10 | 6 | 12 | 11 | 9 | 5 | 3 | 8 |
| 2 | 4 | 1 | 14 | 8 | 13 | 6 | 2 | 11 | 15 | 12 | 9 | 7 | 3 | 10 | 5 | 0 |
| 3 | 15 | 12 | 8 | 2 | 4 | 9 | 1 | 7 | 5 | 11 | 3 | 14 | 10 | 0 | 6 | 13 |
Properties of DES S-boxes:
Because DES uses a Feistel network, decryption uses the same algorithm as encryption, but with the round keys applied in reverse order. That is, to decrypt a ciphertext block, one applies the same 16 rounds with keys K16, K15, ..., K1 (the inverse of the key schedule). The initial and final permutations are also applied (they are inverses of each other).
This property simplifies implementation—the same hardware/software can be used for both encryption and decryption by reversing the key schedule.
The primary weakness of DES is its short key length: 56 bits. This gives a key space of 256 ≈ 7.2×1016 keys. In 1998, the Electronic Frontier Foundation (EFF) built a custom machine, "Deep Crack," that could break DES in about 56 hours, costing around $250,000. Today, with FPGA and GPU clusters, a DES key can be broken in seconds or minutes.
Brute-force feasibility over time:
| Year | Time to break DES | Cost/Technology |
|---|---|---|
| 1977 | Estimated 256 operations → infeasible | No public machine |
| 1993 | ~50 days (Wiener's design) | Custom hardware |
| 1998 | 56 hours | EFF Deep Crack ($250k) |
| 2006 | ~10 days (COPACOBANA) | FPGA cluster |
| 2020 | ~seconds (GPU/FPGA) | Cloud computing |
Due to the key schedule, certain keys lead to weak encryption. These include:
These keys are a minor issue; modern implementations avoid them by checking and rejecting them, but they illustrate the importance of key schedule design.
To extend the life of DES while mitigating its key-size weakness, Triple DES (3DES) was introduced. It applies DES three times with either two or three independent keys.
The standard mode is EDE (Encrypt-Decrypt-Encrypt):
C = EK1(DK2(EK1(P))) P = DK1(EK2(DK1(C)))
Using decryption in the middle is a historical artifact that allows compatibility with single DES (if K1 = K2, then it reverts to DES).
Effective key length: With two keys, the effective key length is 112 bits (2×56). This is because the meet-in-the-middle attack reduces the security to about 2112 operations, which is still infeasible. However, there are better attacks (e.g., 280 with known plaintext) that slightly reduce security, but 3DES with 2 keys is still considered secure for many applications.
C = EK3(DK2(EK1(P)))
Effective key length is 168 bits (3×56). Provides a high margin of security.
NIST has deprecated 3DES for new applications (SP 800-131A, 2015). It is being phased out in favor of AES. The 64-bit block size and the availability of more efficient and secure algorithms make 3DES obsolete.
DES is no longer considered secure for new applications. The small key size makes it vulnerable to brute-force attacks, and the cryptanalytic attacks (linear and differential) are practical. NIST officially withdrew FIPS 46-3 (DES) in 2005. Triple DES was allowed for legacy systems but is now deprecated; NIST SP 800-131A (2015) disallows 3DES for new cryptographic use after 2023.
For modern symmetric encryption, AES (Advanced Encryption Standard) is the recommended algorithm. AES offers 128, 192, or 256-bit keys, a 128-bit block, and is significantly more efficient in both hardware and software.
In 1998, the Electronic Frontier Foundation (EFF) built a machine called "Deep Crack" to demonstrate the vulnerability of DES. The machine consisted of 1,856 custom ASICs, each capable of searching 25 million keys per second. The total cost was about $250,000. It could find a DES key in about 56 hours on average, using a known plaintext-ciphertext pair.
The project successfully broke a DES-encrypted message that was part of a public challenge (the "DES Challenge") within 56 hours. This demonstrated that DES was no longer secure against determined adversaries with moderate resources. It accelerated the adoption of Triple DES and the subsequent AES competition.
Lessons:
Compare the number of possible keys for DES (56-bit), 2-key 3DES (112-bit), and 3-key 3DES (168-bit). How many times larger is the 3-key 3DES key space compared to DES?
DES: 256 ≈ 7.2×1016 keys.
2-key 3DES: 2112 ≈ 5.2×1033 keys.
3-key 3DES: 2168 ≈ 3.7×1050 keys.
Ratio (3-key vs DES): 2168 / 256 = 2112 ≈ 5.2×1033 times larger.
In a simplified Feistel cipher with a 16-bit block (split into L and R of 8 bits), suppose L0 = 0xAB, R0 = 0xCD, and the round function F(R, K) = R ⊕ K. If K1 = 0x5, compute L1 and R1.
L1 = R0 = 0xCD.
R1 = L0 ⊕ F(R0, K1) = 0xAB ⊕ (0xCD ⊕ 0x05) = 0xAB ⊕ 0xC8 = 0x63.
So L1 = 0xCD, R1 = 0x63.
Using the S1 table provided in the tutorial, determine the 4-bit output for the following 6-bit inputs: (a) 001011, (b) 111100, (c) 100101.
For each 6-bit input, the first and last bits form the row (2 bits), and the middle four bits form the column.
(a) 001011: bits = 0 0 1 0 1 1 → row = 01 (binary) = 1, column = 0101 = 5. From S1 row 1, col 5 = 2 (binary 0010).
(b) 111100: row = 10 (2), col = 1110 (14). Row 2, col 14 = 5 (0101).
(c) 100101: row = 11 (3), col = 0010 (2). Row 3, col 2 = 8 (1000).
If a DES key is weak, the round keys are all identical. How does this affect the security of the cipher? Explain why such keys should be avoided.
When all round keys are identical, the Feistel rounds do not provide the intended variability. The cipher reduces to a simple substitution-permutation network with the same key each round, which can be broken much more easily. In particular, the effective key space shrinks to one key (or a few). Such keys must be avoided by implementations, typically by checking and rejecting weak keys during key setup.
Explain the concept of a meet-in-the-middle attack on 2-key 3DES. What is the effective key space reduction achieved by this attack?
In 2-key 3DES (EDE with keys K1 and K2), the meet-in-the-middle attack works by storing intermediate values from the first encryption (EK1) and then matching them with the decryption of the ciphertext (DK2) to find the pair of keys. The complexity is O(256) time and O(256) memory, which is less than the 2112 brute force. Thus, the effective security is about 112 bits (since the attack requires about 256 operations, not 2112). However, this is still infeasible with current technology.
Write a 600-word report on differential and linear cryptanalysis. Focus on how they were applied to DES, including the approximate complexity of the attacks and why DES was designed to resist them. Discuss the historical significance of these attacks.
Complete answer would include: Differential cryptanalysis (Biham and Shamir, 1990) uses chosen plaintext pairs with a fixed difference; it requires 247 chosen plaintexts for DES. Linear cryptanalysis (Matsui, 1993) uses known plaintext linear approximations; it requires 243 known plaintexts and was the first practical attack on DES. The S-boxes were designed to minimize these vulnerabilities (high non-linearity and low differential probability). The attacks showed that DES was not broken, but its margins were thin, encouraging the move to AES.
Create a table comparing DES and AES across the following dimensions: key size, block size, number of rounds, structure (Feistel vs SPN), S-box properties, and current security status. Write a summary of the key advantages of AES over DES.
Table:
| Feature | DES | AES |
|---|---|---|
| Key size | 56 bits | 128, 192, 256 bits |
| Block size | 64 bits | 128 bits |
| Rounds | 16 | 10, 12, 14 (based on key size) |
| Structure | Feistel | SPN |
| S-box | 8 S-boxes (6×4) | 1 S-box (8×8) with algebraic structure |
| Security | Insecure; deprecated | Secure; current standard |
Advantages: Larger key and block sizes, more efficient in software/hardware, stronger resistance to cryptanalysis, and simpler implementation in some aspects.
If the DES key schedule used a fixed shift of 1 bit per round instead of the variable shifts, how would that affect the distribution of round keys and the security of the cipher?
Fixed 1-bit shifts would cause the round keys to be more regular; in particular, the same key bits would appear in multiple round keys with predictable patterns, potentially making the cipher vulnerable to related-key attacks. The variable shifts were designed to ensure that all key bits are used in every round and that the round keys are as independent as possible.
Why is 3DES still considered secure for legacy applications despite its 64-bit block size? What are the primary risks of using 3DES for new systems?
3DES is secure against brute-force attacks due to its 112-bit or 168-bit effective key length. However, the 64-bit block size leads to birthday collisions after about 232 blocks, which is a concern when encrypting large volumes of data (e.g., >32 GB). For new systems, AES provides better security, performance, and larger block size, making 3DES unnecessary and riskier.
Implement DES encryption and decryption in your preferred language (or a simplified version). Test it with a known test vector (e.g., from NIST). Submit a report with your code, test results, and observations about performance and implementation complexity.
Provide a high-level description of a successful implementation, perhaps using a library or custom code. Report that the implementation passed known test vectors, and discuss the complexity of managing bit-level permutations and S-box tables. Observations might include the importance of correct table values and the relatively slow performance compared to AES.
This tutorial provided a comprehensive examination of the Data Encryption Standard (DES) and its successor, Triple DES. We traced the history of DES from its development at IBM and adoption by NIST to its eventual replacement by AES. We dissected the DES algorithm in detail, examining its Feistel structure, key schedule, and round function, with special emphasis on the S-boxes that provide non-linearity.
We analyzed DES's security, highlighting the 56-bit key as its primary weakness, and discussed cryptanalytic attacks (differential and linear) that, while not practical for breaking DES, demonstrate its design strengths. We also reviewed weak keys and the complementation property.
Triple DES (3DES) was introduced as a stopgap to extend DES's life by increasing key length. We covered the 2-key and 3-key variants, their effective key lengths, and the meet-in-the-middle attack. We also discussed the limitations of 3DES, including its 64-bit block size and performance overhead, leading to its deprecation.
The case study of the EFF DES cracker illustrated the practical vulnerability of DES to brute-force attacks and underscored the importance of adequate key length in cryptographic design. The lessons learned from DES and 3DES have informed the design of modern ciphers like AES.
In Tutorial 2.6: Advanced Encryption Standard (AES), we will study the successor to DES—a modern block cipher that is now the global standard. AES builds on the principles we have covered: it is an SPN (not Feistel), with a larger block (128 bits) and key sizes up to 256 bits. Understanding DES will help you appreciate the design choices and improvements in AES.