Tutorial 2.5: Data Encryption Standard (DES) and Triple DES

Table of Contents

Learning Objectives

After completing this tutorial, you should be able to:

Overview

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.

Relationship to the Tutorial Series

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).

History of DES

Origins and Adoption

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.

Designers and Key Personnel

DES Overview

DES Parameters

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.

┌─────────────────────────────────────────────────────────────────────┐ │ OVERALL DES STRUCTURE │ ├─────────────────────────────────────────────────────────────────────┤ │ │ │ 64-bit Plaintext │ │ │ │ │ ▼ │ │ ┌─────────┐ │ │ │ Initial │ (IP) │ │ │Permutation│ │ │ └─────────┘ │ │ │ │ │ ▼ │ │ ┌─────────────────────────────────────────────────────────┐ │ │ │ 16 ROUNDS │ │ │ │ Each round: Li+1 = Ri; │ │ │ │ Ri+1 = Li ⊕ F(Ri, Ki)│ │ │ where Ki is the i-th round key │ │ │ └─────────────────────────────────────────────────────────┘ │ │ │ │ │ ▼ │ │ ┌─────────┐ │ │ │ Final │ (IP−1) │ │ │Permutation│ │ │ └─────────┘ │ │ │ │ │ ▼ │ │ 64-bit Ciphertext │ │ │ └─────────────────────────────────────────────────────────────────────┘

Figure 1: Overall DES encryption process.

The Feistel Structure of DES

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).

┌─────────────────────────────────────────────────────────────────┐ │ DES ROUND (Feistel) │ ├─────────────────────────────────────────────────────────────────┤ │ │ │ Li−1 (32 bits) Ri−1 (32 bits) │ │ │ │ │ │ │ ▼ │ │ │ ┌─────────────┐ │ │ │ │ Expansion │ 32→48 bits │ │ │ │ (E-box) │ │ │ │ └──────┬──────┘ │ │ │ │ │ │ │ ▼ │ │ │ ┌─────────────┐ │ │ │ │ XOR with │ 48-bit round key │ │ │ │ Ki │ │ │ │ └──────┬──────┘ │ │ │ │ │ │ │ ▼ │ │ │ ┌─────────────┐ │ │ │ │ S-boxes │ 48→32 bits │ │ │ │ (8 S-boxes) │ │ │ │ └──────┬──────┘ │ │ │ │ │ │ │ ▼ │ │ │ ┌─────────────┐ │ │ │ │ Permutation │ P-box (32 bits) │ │ │ │ (P-box) │ │ │ │ └──────┬──────┘ │ │ │ │ │ │ │ ▼ │ │ │ ┌─────────────┐ │ │ └───────────────────►│ XOR │ │ │ │ Li−1⊕F│ │ │ └──────┬──────┘ │ │ │ │ │ ▼ │ │ Li = Ri−1 Ri (new) │ │ │ └─────────────────────────────────────────────────────────────────┘

Figure 2: One round of DES (round i).

Key Schedule

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:

  1. Parity drop (PC-1): Remove the 8 parity bits from positions 8, 16, ..., 64, producing a 56-bit key. Also permutes the remaining bits.
  2. Split the 56 bits into two 28-bit halves, C₀ and D₀.
  3. For round i = 1 to 16:

The PC-1 and PC-2 tables are fixed and standardized. The shift schedule is:

Round12345678910111213141516
Left shifts1122222212222221

The Round Function (F)

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:

  1. Expansion (E-box): The 32-bit R is expanded to 48 bits by duplicating some bits according to a fixed expansion table. This makes the output depend on a wider set of input bits and also matches the key size.
  2. XOR with round key: The 48-bit expanded block is XORed with the 48-bit round key Ki.
  3. S-box substitution: The 48-bit result is divided into eight 6-bit chunks. Each 6-bit chunk is fed into a corresponding S-box (S1 through S8), which outputs 4 bits. Each S-box is a 4×16 table (row and column) mapping 6-bit input to 4-bit output. This is the only non-linear step in DES and provides confusion.
  4. Permutation (P-box): The resulting 32 bits (8×4) are permuted according to a fixed permutation table, spreading the output bits.

The output of the P-box is the output of F, which is then XORed with the left half.

S-boxes and Their Significance

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\Col0123456789101112131415
01441312151183106125907
10157414213110612119538
24114813621115129731050
31512824917511314100613

Properties of DES S-boxes:

Key Insight: The S-boxes are the only source of non-linearity in DES. The expansion, XOR, and permutation are linear operations. If the S-boxes were linear, DES could be broken easily using linear algebra.

Decryption

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.

Security Analysis of DES

Brute-Force Attack (Key Space)

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:

YearTime to break DESCost/Technology
1977Estimated 256 operations → infeasibleNo public machine
1993~50 days (Wiener's design)Custom hardware
199856 hoursEFF Deep Crack ($250k)
2006~10 days (COPACOBANA)FPGA cluster
2020~seconds (GPU/FPGA)Cloud computing

Cryptanalytic Attacks

Weak and Semi-Weak Keys

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.

Triple DES (3DES)

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.

2-Key 3DES (3DES with K1, K2)

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.

3-Key 3DES (3DES with K1, K2, K3)

C = EK3(DK2(EK1(P)))

Effective key length is 168 bits (3×56). Provides a high margin of security.

Security of 3DES

Current Status

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.

Current Status and Deprecation

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.

Case Study: The EFF DES Cracker

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:

Key Takeaways

Section Summaries

Quiz

  1. What is the effective key length of DES, and why is it considered insecure today?
  2. AnswerDES has an effective key length of 56 bits. It is considered insecure because modern hardware can perform a brute-force search over 256 keys in a very short time (seconds to minutes), making it feasible for attackers.
  3. What is the block size of DES, and how many rounds does it use?
  4. AnswerDES uses a 64-bit block and performs 16 rounds of encryption.
  5. Explain the role of the S-boxes in DES and why they are essential for security.
  6. AnswerThe S-boxes are the only non-linear component of DES. They provide confusion by mapping 6-bit inputs to 4-bit outputs in a non-linear way, making it difficult to express the cipher as a linear system. Without them, DES would be easily broken using linear algebra.
  7. What is the complementation property of DES, and how does it affect brute-force attacks?
  8. AnswerIf C = EK(P), then E(P̄) = C̄ (complementing all bits). This property can reduce the effective key space by a factor of 2 in a chosen-plaintext attack because an attacker can test two keys at once by complementing the plaintext and ciphertext.
  9. What is the difference between 2-key and 3-key Triple DES?
  10. Answer2-key 3DES uses two independent keys (K1 and K2) in an EDE pattern, giving an effective key length of 112 bits. 3-key 3DES uses three independent keys (K1, K2, K3), giving an effective key length of 168 bits. The former is less secure but still adequate for many legacy applications; the latter provides a higher security margin.
  11. What is the main vulnerability of 3DES that led to its deprecation?
  12. Answer3DES still uses a 64-bit block, making it vulnerable to birthday attacks when encrypting large amounts of data (more than about 232 blocks). Additionally, it is much slower than AES and offers no advantage over modern ciphers.
  13. How does the key schedule of DES generate round keys?
  14. AnswerThe 56-bit key is split into two 28-bit halves. For each round, the halves are left-shifted by 1 or 2 bits (depending on the round), and then a compression permutation (PC-2) selects 48 bits to form the round key. This process is repeated for 16 rounds.
  15. What is a weak key in DES, and how many exist?
  16. AnswerA weak key is one where encryption is its own inverse (i.e., EK(EK(P)) = P). There are 4 weak keys in DES. They cause all round keys to be identical, drastically weakening the cipher.
  17. What is the avalanche effect in the context of DES?
  18. AnswerThe avalanche effect is the property that a small change in the plaintext or key results in a large change in the ciphertext. DES exhibits good avalanche effect: changing one bit of plaintext typically changes about half the ciphertext bits after several rounds.
  19. Why was the NSA's involvement in DES design controversial?
  20. AnswerThe NSA contributed to the S-box design and reduced the key size from 128 bits to 56 bits. Many suspected that the NSA might have inserted a backdoor or deliberately weakened the cipher. Later research showed that the S-boxes were designed to resist differential cryptanalysis, but the key size reduction was indeed a security concern.

Exercises

  1. Key Size Comparison

    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?

  2. Sample Solution

    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.

  3. Feistel Round Calculation

    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.

  4. Sample Solution

    L1 = R0 = 0xCD.

    R1 = L0 ⊕ F(R0, K1) = 0xAB ⊕ (0xCD ⊕ 0x05) = 0xAB ⊕ 0xC8 = 0x63.

    So L1 = 0xCD, R1 = 0x63.

  5. Understanding S-boxes

    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.

  6. Sample Solution

    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).

  7. Weak Key Analysis

    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.

  8. Sample Solution

    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.

  9. Meet-in-the-Middle Attack on 2-key 3DES

    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?

  10. Sample Answer

    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.

Homework

  1. Research: Differential and Linear Cryptanalysis

    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.

  2. Sample Answer

    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.

  3. Compare DES and 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.

  4. Sample Answer

    Table:

    FeatureDESAES
    Key size56 bits128, 192, 256 bits
    Block size64 bits128 bits
    Rounds1610, 12, 14 (based on key size)
    StructureFeistelSPN
    S-box8 S-boxes (6×4)1 S-box (8×8) with algebraic structure
    SecurityInsecure; deprecatedSecure; current standard

    Advantages: Larger key and block sizes, more efficient in software/hardware, stronger resistance to cryptanalysis, and simpler implementation in some aspects.

  5. Analyze the DES Key Schedule

    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?

  6. Sample Answer

    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.

  7. Security of 3DES

    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?

  8. Sample Answer

    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.

  9. Mini-Project: Implement DES (optional)

    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.

  10. Sample Answer

    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.

Summary

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.

Connection to the Next Tutorial

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.