Chapter 6 DES
Chapter 6 DES
(DES)
Introduction
The Data Encryption Standard (DES) is a symmetric-key block cipher
published by the National Institute of Standards and Technology (NIST).
In 1973, NIST published a request for proposals for a national symmetric-
key cryptosystem.
A proposal from IBM, a modification of a project called Lucifer, was
accepted as DES.
DES was published in the Federal Register in March 1975 as a draft of the
Federal Information Processing Standard (FIPS).
Heavily criticized: Small key length (56 bits) and Concern about some hidden
design behind the internals of DES.
Finally, published as “FIPS46” in Federal Register in Jan 1977.
Most popular symmetric key block cipher.
However, DES is insecure, due to small key size.
Later, NIST issued a new standard (FIPS 46-3), recommending the use of
triple DES (repeat DES three times), which is secure.
According to the famous information theorist Claude Shannon, there
are two primitive operations with which strong encryption algorithms
can be built:
Confusion is an encryption operation where the relationship between key
and ciphertext is obscured.
Today, a common element for achieving confusion is substitution, which is found
in both DES and AES. 2.
Example
Find the output of the final permutation box when
the input is given in hexadecimal as:
Solution
Only bit 25 and bit 63 are 1s; the other bits are 0s. In
the final permutation, bit 25 becomes bit 64 and bit
63 becomes bit 15. The result is
Initial and Final Permutations
Example
Prove that the initial and final permutations are the
inverse of each other by finding the output of the
initial permutation if the input is
Solution
The input has only two 1s; the output must also have
only two 1s. Using the final permutation table, we
can find the output related to these two bits. Bit 15 in
the input becomes bit 63 in the output. Bit 64 in the
input becomes bit 25 in the output. So the output has
only two 1s, bit 25 and bit 63. The result in
hexadecimal is
Rounds in DES
DES Function
The heart of DES is the DES
function.
The DES function applies a
48-bit key to the rightmost 32
bits to produce a 32-bit
output.
Four sections:
An expansion Box
Whitener (that adds key)
A group of S-boxes.
A straight Box
Rounds in DES: Expansion P-box
Expansion P-box
Since RI−1 is a 32-bit input and KI is a 48-bit key, we first need to expand
RI−1 to 48 bits.
RI−1 is divided into 8 4-bit sections (8X4=32 bits).
Each 4 bit is then expanded to 6 bits (32 + 2X8=48 bits), following a
predefined rule.
For each section:
Input bits 1, 2, 3, and 4 are copied to output bits 2, 3, 4, and 5.
Bit 1 of output comes from bit 4 of the previous section.
Bit 6 ………………………… bit 1 ……… next section.
Rounds in DES: Expansion P-box
Although the relationship between the input and output can be defined
mathematically, DES uses the following table to define this P-box.
S-box rule
S-Box Rule:
Use the 1st and 6th bit
of the input for one
of the four rows.
Use bits 2-to-5 of the
input for one of the
columns.
Rounds in DES: S-Boxes
6.18
Table below shows the permutation for S-box 1.
For the rest of the boxes see the textbook.
The values are given in decimal.
S-box 1
Rounds in DES: S-Boxes
Example
The input to S-box 1 is 100011. What is the output?
Solution
If we write the first and the sixth bits together, we get
11 in binary, which is 3 in decimal. The remaining bits
are 0001 in binary, which is 1 in decimal. We look for
the value in row 3, column 1, in Table 6.3 (S-box 1).
The result is 12 in decimal, which in binary is 1100. So
the input 100011 yields the output 1100.
Final Permutation
Straight Permutation
Last operation in DES, is to permutes 32-bit input to a
32-bit output.
The table below shows the input/output relationship,
which is same as before.
E.g., 7th bit of the input becomes 2nd bit of the
output.
Straight permutation table
Cipher and Reverse Cipher
Using mixers and
swappers, we can
create the cipher
and reverse cipher,
each having 16
rounds.
One approach is to
make the last round
(round 16) different
from the others; it
has only a mixer and
no swapper.
NOTE: There is no
swapper in the last
round.
The round key
should be applied in
the reverse order.
Cipher and Reverse Cipher
Pseudocode for DES cipher
Initial Permutation
Split in Left and Right sub-blocks of 32 bits
16 rounds
Mixer
Swapper
f(RI-1,KI)
Cipher and Reverse Cipher
Pseudocode for DES cipher (Continued)
S-Boxes
Cipher and Reverse Cipher
Cipher and Reverse Cipher
Key-compression table
DES: Key generation
Next, we show that Round 16 of DES Encryption is the inverse of Round 1 of DES
Decryption.
Next, we show that the first decryption round reverses the last
encryption round.
DES Decryption
Example
To check the avalanche effect in DES, let us encrypt two plaintext blocks (with
the same key) that differ only in one bit and observe the differences in the
number of bits in each round.
DES Analysis
Example Continued
Although the two plaintext blocks differ only in the rightmost bit, the ciphertext
blocks differ in 29 bits.
This means that changing approximately 1.5 percent of the plaintext creates a
change of approximately 45 percent in the ciphertext.
If we can check one million keys per second, we may need two
thousand years to do a brute-force attack on DES using a
computer with one processor.
However, if we make a computer with one million chips, then we
can check the whole key domain in approx. 20 hours.
A special computer built in 1998 can find the key in 112 hours.
Weak Key: Four out of 256 keys are called weak keys.
A weak key is one that, after parity drop operation, ends up with all
0s, all 1s, or half 0s and half 1s.
Table below lists the weak keys.
The round keys created from any of these weak keys are the same
and have the same pattern as the cipher key.
E.g. the 16 keys created from the first key is all made of 0s and one
with the 2nd key is made of half 0s and half 1s.
Weakness in the cipher key
Example
Let us try the first weak key in Table shown above to encrypt a block
two times. After two encryptions
with the same key the original plaintext block is created. Note that we
have used the encryption algorithm two times, not one encryption
followed by another decryption.
Weakness in the cipher key
Semi-Weak Key: There are 6 key pairs that are called semi-weak
keys, as shown below (all 64 bit format).
A semi-weak keys creates only two different round keys and each of
them is repeated eight times.
In addition, the round keys created from each pair are the same with
different orders.
Weakness in the cipher key
Round keys created from the first pair are shown below.
There are 8 equal round keys in each semi-week key.
In addition, round key 1 in the 1st set is same as the round key 16 in the 2nd. Same is true for
round key 2 in the 1st set and round key 15 in the 2nd, and so on.
This means that the keys are inverse of each other. Ek2(Ek1(P)) = P.
To see this, assume 𝑘1 = 9153𝐸54319𝐵𝐷 6𝐸𝐴𝐶1𝐴𝐵𝐶𝐸642 and 𝑘2 = 6𝐸𝐴𝐶1𝐴𝐵𝐶𝐸642 9153𝐸54319𝐵𝐷
Notice that the last round key in the encryption (i.e., 𝑘2 ) is the first round key of Decryption
(i.e., 𝑘1 ).
Weakness in the cipher key
Possible Weak Keys: In addition, there are 48 keys that
are called possible weak keys.
A possible weak keys is a key that creates only four
distinct round keys.
Example 6.9
What is the probability of randomly selecting a weak, a semi-
weak, or a possible weak key?
Solution
DES has a key domain of 256. The total number of the above
keys are 64 (4 + 12 + 48). The probability of choosing one of
these keys is 8.8 × 10−16, almost impossible.
Weakness in the cipher key
Key Complement: In the key domain (256 ), definitely half of the
keys are complement of the other half.
A key complement can be made by inverting (0 1 and 1 0) each
bot in the key.
Question: Does key complement simplify the job of cryptanalysis?
It does. Attacker can use only half of the possible keys (255 ) to perform
brute-force attack.
This is because: 𝐶 = 𝐸 𝐾, 𝑃 → 𝐶 ′ = 𝐸(𝐾 ′ , 𝑃′)
In other words, if we encrypt the complement of PT with the
complement of the key, we get the complement of the CT.
So, attacker can just test only half of the 256 possible keys and then
complement the result.
Weakness in the cipher key
Example
Let us test the claim about the complement keys. We have used an arbitrary key and
plaintext to find the corresponding ciphertext. If we have the key complement and the
plaintext, we can obtain the complement of the previous ciphertext
DES Attacks
Exhaustive Key Search (Brute-force attack): It is clear that DES can
be broken in 255 tries.
In 1977, Whitfield Diffie and Martin Hellman estimated that it was
possible to build an exhaustive key-search machine for approx.
$20,000,000.
At CRYPTO 1993 conference, Michael Wiener proposed the design
of a very efficient key-search machine using pipelining techniques
for DES.
He estimated the cost of his design at approximately $1,000,000, and
the time required to find the key at 1.5 days.
This was a proposal only, and the machine was not built.
In 1998, however, the EFF (Electronic Frontier Foundation) built the
hardware machine Deep Crack, which performed a brute-force
attack against DES in 56 hours.
The average search time of Deep Crack was 15 days, and the
machine was built for less than $250,000
DES Attacks
Deep Crack: the hardware exhaustive key-search machine that broke DES in
1998
The successful break with Deep Crack was considered the official demonstration
that DES is no longer secure against determined attacks by many people.
DES Attacks
Dictionary attack:
Each plaintext may result in 264 different ciphertexts, but there
are only 256 possible different key values.
Encrypt the known plaintext with all possible keys.
Keep a look up table of size 256
Given a Plaintext/Ciphertext pair (P,C), look up C in the table.
Problem with this attack is the size of the lookup table can
be very large.
i.e., Number of known PT characters (of 64 bits = 8 bytes) times
256 , in the worst case.
DES Attacks
Analytical Attack:
In 1990, Eli Biham and Adi Shamir discovered what is called
differential cryptanalysis (DC). This is a powerful attack which is in
principle applicable to any block cipher
However, it turned out that the DES S-boxes are particularly resistant
against this attack.
It has been revealed that the designers of DES already knew about
this type of attack and designed S-boxes and chose 16 as the
number of rounds to make DES specifically resistant to this type of
attack.
Today it is shown that DES can be broken using DC if we have 247
chosen plaintexts or 255 known plaintexts.
The assumption is impractical as it requires terabytes of PT-CT pair (recall
that 1 Terabyte = 240 bytes) .
DES Attacks
In 1993 a related but distinct analytical attack was published by
Mitsuru Matsui, which was named linear cryptanalysis (LC).
Similar to differential cryptanalysis, the effectiveness of this
attack also heavily depends on the structure of the S-boxes.
It has been shown that DES can be broken by LC using 243 pairs
of known plaintexts.
Again, not practical.
Summary:
With today’s computational power, we can use Brute-force attack
to crack DES in days.
Other types of attack, i.e. DC or LC, is not practical.
DES is insecure.
DES Alternatives
One proposed solution: double DES or 2-DES.
Although, 3-DES is generally considered as a secure
alternative DES.
Why not 2-DES?