Block Cipher Principles and the Data Encryption Standard (DES)
Cryptography and Block Cipher Principles
- Modern Block Ciphers: These are among the most widely used types of cryptographic algorithms and are essential for providing secrecy and authentication services.
- Data Encryption Standard (DES): This serves as the primary focus to illustrate fundamental block cipher design principles.
- Encryption Methodology: Block ciphers encrypt data one block at a time, unlike stream ciphers which process data bit by bit.
- Applications: Block ciphers are utilized in a broader range of applications compared to stream ciphers.
- Block Size: Typical block sizes for modern algorithms range from 64 to 128 bits.
- Feistel Block Cipher: Most current block cipher algorithms are based on the Feistel cipher structure.
Comparison of Block and Stream Ciphers
- Stream Ciphers:
- Process data as a continuous bit stream (Pi).
- Utilize a key (K) and an algorithmic bit stream generator to produce a cryptographic bit stream (ki).
- Ciphertext (Ci) is produced by a bitwise XOR transition: Pi⊕ki=Ci.
- Block Ciphers:
- Process data in fixed-length segments called blocks of length b bits.
- Apply an encryption algorithm using a key (K) to the entire block of plaintext to produce a block of ciphertext of equal length (b bits).
Block Cipher Principles and the Ideal Block Cipher
- General Principles:
- An n-bit block cipher takes an n-bit plaintext and produces an n-bit ciphertext.
- There are 2n possible different plaintext blocks.
- Encryption must be reversible, meaning decryption is possible.
- To be reversible, each plaintext block must map to a unique ciphertext block (one-to-one mapping).
- The total number of possible transformations is (2n)!.
- The Ideal Block Cipher:
- The key is essentially the mapping table itself.
- Key length for an ideal block cipher is (2n×n).
- Example: For a 4-bit block, the key length is 24×4=16×4=64 bits (formed by concatenating all bits of the ciphertext table).
- Problems with Ideal Block Ciphers:
- Small Block Size: If n is small (e.g., 4), it is equivalent to a classical substitution cipher, making cryptanalysis based on statistical characteristics feasible.
- Large Block Size: To be secure, n must be large, but this causes the key length to grow exponentially. For an actual block size of at least 64 bits, the key length would be 264×64≈1021 bits, causing implementation and performance issues.
Feistel Cipher Structure and Design Concepts
- Feistel's Proposal: Feistel proposed applying two or more simple ciphers in sequence so the final result is cryptographically stronger than the component ciphers. This involves alternating substitutions and transpositions (permutations).
- Feistel Parameters:
- Block length: n bits.
- Key length: k bits.
- Transformations: 2k (rather than (2n)!).
- Shannon’s Concepts:
- Diffusion: Reducing the statistical nature of the plaintext in the ciphertext. One plaintext letter should affect the value of many ciphertext letters. This is achieved by repeatedly applying permutations (transpositions) to the data followed by a function.
- Confusion: Making the relationship between the ciphertext and the key as complex as possible. Use complex, non-linear substitution algorithms so that even if statistical characteristics of the ciphertext are found, the key remains difficult to deduce.
- Feistel Construction Approach:
- The plaintext is split into two halves: Left (L) and Right (R).
- Subkeys (round keys Ki) are generated from the main key.
- A round function F is applied to the right half with the subkey.
- Substitution is performed on the left half using an XOR operation with the output of F.
- A permutation (interchange) of the two halves is performed.
- Design Trade-offs: Factors include block size (64,128 bits), key size (e.g., 128 bits), number of rounds (e.g., 16), subkey generation complexity, and round function complexity. The primary trade-off is security versus performance.
Data Encryption Standard (DES) Overview
- General Properties:
- Symmetric block cipher.
- 64-bit input/output block size.
- 56-bit key length (nominally 64-bit, but 8 bits are used for parity).
- History: Developed in 1977 by NBS (now NIST). Designed primarily by IBM (based on the Lucifer cipher) with input from the NSA.
- Algorithm Structure:
- Initial Permutation (IP): The first step, reordering the bits of the 64-bit input.
- 16 Rounds of Processing: Each round involves subkey generation and the Feistel function.
- 32-bit Swap: After the 16th round, the left and right halves are swapped.
- Inverse Initial Permutation (IP−1): The final step of the algorithm.
DES Round Structure and Mathematical Components
- Expansion/Permutation (E table): Expands the 32-bit right half of the data to 48 bits to match the subkey length.
- Subkey Mixed XOR: The 48-bit expanded data is XORed with the 48-bit subkey (Ki).
- Substitution/Choice (S-boxes): The 48-bit result is fed into eight S-boxes. Each S-box takes 6 bits as input and produces 4 bits as output, resulting in a 32-bit total output.
- S-boxes provide the non-linearity to the cipher and are considered the most secure part of DES.
- Permutation (P table): A 32-bit permutation is applied to the output of the S-boxes to increase diffusion.
- Mathematical Representation of a Round:
- Li=Ri−1
- Ri=Li−1⊕F(Ri−1,Ki)
DES Key Schedule Calculation
- Permuted Choice 1 (PC-1): The initial 64-bit key is reduced to 56 bits by selecting specific bits and discarding parity bits (8,16,24,32,40,48,56,64).
- Left Circular Shifts: The 56 bits are split into two 28-bit halves. In each round, these halves are shifted left. Rounds 1,2,9, and 16 involve a single shift, while others involve two shifts.
- Permuted Choice 2 (PC-2): After shifting, 48 bits are selected from the 56 bits to serve as the subkey (Ki) for that round.
The Avalanche Effect
- Definition: A small change in either the plaintext or the key should produce a significant change in the ciphertext.
- DES Performance:
- A 1-bit change in plaintext results in approximately 32 output bits changing after 16 rounds.
- Example:
- Plaintext 1:
02468aceeca86420 - Plaintext 2:
12468aceeca86420 (1 bit difference) - Ciphertext difference after IP-1: 32 bits.
- A 1-bit change in the key results in approximately 30 output bits changing.
Security and Attacks on DES
- Brute Force Resistance:
- 256≈7.2×1016 possible keys.
- In 1977, it was estimated that a machine costing 20 million USD could break it in 10 hours.
- In 1998, the Electronic Frontier Foundation (EFF) built a machine for 250,000 USD that broke DES in 3 days.
- Today, 56 bits is considered too short to withstand brute force.
- Analytical Attacks:
- Timing Attacks: Information gained by observing how long decryption takes. No known useful attacks on DES.
- Differential Cryptanalysis: Observes how pairs of plaintext blocks evolve. Can break DES in 247 operations, but requires 247 chosen plaintexts.
- Linear Cryptanalysis: Finds linear approximations of transformations. Can break DES using 243 known plaintexts.
Average Time Required for Exhaustive Key Search
| Key Size (bits) | Cipher | Number of Alternative Keys | Time at 109 decryptions/s | Time at 1013 decryptions/s |
|---|
| 56 | DES | 256=7.2×1016 | 2.15 hours | 1.125 years |
| 128 | AES | 2128=3.4×1038 | 5.3×1021 years | 5.3×1017 years |
| 168 | Triple DES | 2168=3.7×1050 | 5.8×1033 years | 5.8×1029 years |
| 192 | AES | 2192=6.3×1057 | 9.8×1040 years | 9.8×1036 years |
| 256 | AES | 2256=1.2×1077 | 1.8×1060 years | 1.8×1056 years |
| 26 characters | Monoalphabetic | 26!=4×1026 | 6.3×109 years | 6.3×106 years |
Multiple Encryption and Variations of DES
- Double DES: Uses two 56-bit keys for a total length of 112 bits. However, it is vulnerable to the Meet-in-the-middle attack, making it not much better than single DES.
- Triple DES (3DES):
- With 2 keys: Provides a brute force resistance of 2112.
- With 3 keys: Provides a brute force resistance of 2168.
- Maintains compatibility with DES software and equipment while increasing key length to 128 bits (or higher).