0% found this document useful (0 votes)
468 views

Data Encryption Standard (DES)

The document discusses the Data Encryption Standard (DES) algorithm. It provides a brief history of DES and an overview of its structure. DES is a symmetric-key block cipher that uses a 56-bit key and operates on 64-bit blocks through 16 rounds of encryption. Each round uses key schedule-generated round keys for diffusion and confusion of the plaintext block to generate the ciphertext block.

Uploaded by

RAJ TAPASE
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
468 views

Data Encryption Standard (DES)

The document discusses the Data Encryption Standard (DES) algorithm. It provides a brief history of DES and an overview of its structure. DES is a symmetric-key block cipher that uses a 56-bit key and operates on 64-bit blocks through 16 rounds of encryption. Each round uses key schedule-generated round keys for diffusion and confusion of the plaintext block to generate the ciphertext block.

Uploaded by

RAJ TAPASE
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 87

Data Encryption Standard

(DES)

6.1
Objectives

❏ To review a short history of DES

❏ To define the basic structure of DES

❏ To describe the details of building elements of DES

❏ To describe the round keys generation process

❏ To analyze DES

6.2
6-1 INTRODUCTION

The Data Encryption Standard (DES) is a symmetric-


key block cipher published by the National Institute of
Standards and Technology (NIST).

Topics discussed in this section:


6.1.1 History
6.1.2 Overview

6.3
6.1.1 History

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

6.4
6.1.2 Overview

DES is a block cipher, as shown in Figure 6.1.

Figure 6.1 Encryption and decryption with DES

6.5
6-2 DES STRUCTURE

The encryption process is made of two permutations


(P-boxes), which we call initial and final
permutations, and sixteen Feistel rounds.

Topics discussed in this section:


6.2.1 Initial and Final Permutations
6.2.2 Rounds
6.2.3 Cipher and Reverse Cipher
6.2.4 Examples
6.6
6-2 Continue

Figure 6.2 General structure of DES

6.7
Outline of
Algorithm

Figure courtesy :
Applied
Cryptography,
Bruce Schneier
6.8
6.2.1 Initial and Final Permutations

Figure 6.3 Initial and final permutation steps in DES

6.9
6.2.1 Continue

Table 6.1 Initial and final permutation tables

6.10
6.2.1 Continued

Example 6.1

Find the output of the initial permutation box when the input
is given in hexadecimal as:

Solution
Only bit 25 and bit 64 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

6.11
6.2.1 Continued

Example 6.2
Prove that the initial and final permutations are the inverse
of each other by finding the output of the final permutation if
the input is

Solution
The input has only two 1s; the output must also have only two
1s. Using Table 6.1, 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

6.12
6.2.1 Continued

Note

The initial and final permutations are


straight P-boxes that are inverses
of each other.
They have no cryptography significance in
DES.

6.13
A round in DES

6.14
6.2.2 Rounds

DES uses 16 rounds. Each round of DES is a Feistel


cipher.

Figure 6.4
A round in DES
(encryption site)

6.15
6.2.2 Continued
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.

Figure 6.5
DES function

6.16
6.2.2 Continue

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.

Figure 6.6 Expansion permutation

6.17
6.2.2 Continue

Although the relationship between the input and output


can be defined mathematically, DES uses Table 6.2 to
define this P-box.

Table 6.6 Expansion P-box table

6.18
6.2.2 Continue

Whitener (XOR)
After the expansion permutation, DES uses the XOR
operation on the expanded right section and the round
key. Note that both the right section and the key are 48-
bits in length. Also note that the round key is used only in
this operation.

6.19
6.2.2 Continue

S-Boxes
The S-boxes do the real mixing (confusion). DES uses 8
S-boxes, each with a 6-bit input and a 4-bit output. See
Figure 6.7.

Figure 6.7 S-boxes

6.20
6.2.2 Continue

Figure 6.8 S-box rule

6.21
6.2.2 Continue
Table 6.3 shows the permutation for S-box 1. For the rest
of the boxes see the textbook.

Table 6.3 S-box 1

6.22
6.2.2 Continued
Example 6.3

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.

6.23
6.2.2 Continued
Example 6.4

The input to S-box 8 is 000000. What is the output?

Solution
If we write the first and the sixth bits together, we get 00 in
binary, which is 0 in decimal. The remaining bits are 0000 in
binary, which is 0 in decimal. We look for the value in row 0,
column 0, in Table 6.10 (S-box 8). The result is 13 in decimal,
which is 1101 in binary. So the input 000000 yields the output
1101.

6.24
6.2.2 Continue

Straight Permutation

Table 6.11 Straight permutation table

6.25
6.2.3 Cipher and Reverse Cipher

Using mixers and swappers, we can create the cipher and


reverse cipher, each having 16 rounds.

First Approach
To achieve this goal, one approach is to make the last
round (round 16) different from the others; it has only a
mixer and no swapper.

Note

In the first approach, there is no swapper in


the last round.
6.26
6.2.3 Continued
Figure 6.9 DES cipher and reverse cipher for the first approach

6.27
6.2.3 Continued

Algorithm 6.1 Pseudocode for DES cipher

6.28
6.2.3 Continued

Algorithm 6.1 Pseudocode for DES cipher (Continued)

6.29
6.2.3 Continued

Algorithm 6.1 Pseudocode for DES cipher (Continued)

6.30
6.2.3 Continued

Algorithm 6.1 Pseudocode for DES cipher (Continued)

6.31
6.2.3 Continued

Alternative Approach
We can make all 16 rounds the same by including one
swapper to the 16th round and add an extra swapper after
that (two swappers cancel the effect of each other).

Key Generation
The round-key generator creates sixteen 48-bit keys out
of a 56-bit cipher key.

6.32
6.2.3 Continued

Figure 6.10
Key generation

6.33
6.2.3 Continued

Table 6.12 Parity-bit drop table

Table 6.13 Number of bits shifts

6.34
6.2.3 Continued

Table 6.14 Key-compression table

6.35
6.2.3 Continued

Algorithm 6.2 Algorithm for round-key generation

6.36
6.2.3 Continued

Algorithm 6.2 Algorithm for round-key generation (Continue)

6.37
6.2.4 Examples
Example 6.5
We choose a random plaintext block and a random key, and
determine what the ciphertext block would be (all in
hexadecimal):

Table 6.15 Trace of data for Example 6.5

6.38
6.2.4 Continued
Example 6.5 Continued

Table 6.15 Trace of data for Example 6.5 (Conintued

6.39
6.2.4 Continued
Example 6.6
Let us see how Bob, at the destination, can decipher the
ciphertext received from Alice using the same key. Table 6.16
shows some interesting points.

6.40
6-3 DES ANALYSIS

Critics have used a strong magnifier to analyze DES.


Tests have been done to measure the strength of some
desired properties in a block cipher.

Topics discussed in this section:


6.3.1 Properties
6.3.2 Design Criteria
6.3.3 DES Weaknesses

6.41
6.3.1 Properties

Two desired properties of a block cipher are the


avalanche effect and the completeness.

Example 6.7
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.

6.42
6.3.1 Continued
Example 6.7 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.

Table 6.17 Number of bit differences for Example 6.7

6.43
6.3.1 Continued

Completeness effect
Completeness effect means that each bit of the ciphertext
needs to depend on many bits on the plaintext.

6.44
6.3.2 Design Criteria

S-Boxe
The design provides confusion and diffusion of bits from
each round to the next.
P-Boxes
They provide diffusion of bits.

Number of Rounds
DES uses sixteen rounds of Feistel ciphers. the ciphertext
is thoroughly a random function of plaintext and
ciphertext.

6.45
Strength of DES – Key Size

 56-bit keys have 256 = 7.2 x 1016 values


 brute force search looks hard
 recent advances have shown is possible
 in 1997 on Internet in a few months
 in 1998 on dedicated h/w (EFF – Electronic
Frontier Foundation) in a few days
 in 1999 above combined in 22hrs!
 still must be able to recognize plaintext
 now considering alternatives to DES
Strength of DES – Timing Attacks

 attacks actual implementation of cipher


 use knowledge of consequences of
implementation to derive knowledge of
some/all subkey bits
 specifically use fact that calculations can
take varying times depending on the value
of the inputs to it
 particularly problematic on smartcards
Strength of DES – Analytic Attacks

 now have several analytic attacks on DES


 these utilise some deep structure of the cipher
 by gathering information about encryptions
 can eventually recover some/all of the sub-key bits
 if necessary then exhaustively search for the rest
 generally these are statistical attacks
 include
 differential cryptanalysis
 linear cryptanalysis
 related key attacks
6.3.3 DES Weaknesses

During the last few years critics have found some


weaknesses in DES.
Weaknesses in Cipher Design
1. Weaknesses in S-boxes
2. Weaknesses in P-boxes
3. Weaknesses in Key

6.49
6.3.3 Continued
Example 6.8
Let us try the first weak key in Table 6.18 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.

6.50
6.3.3 Continued

Figure 6.11 Double encryption and decryption with a weak key

6.51
6.3.3 Continued

6.52
6.3.3 Continued

6.53
6.3.3 Continued

Figure 6.12 A pair of semi-weak keys in encryption and decryption

6.54
6.3.3 Continued
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.

6.55
6.3.3 Continued

6.56
6.3.3 Continued
Example 6.10

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
(Table 6.20).

6.57
6-4 Multiple DES

The major criticism of DES regards its key length.


Fortunately DES is not a group. This means that we
can use double or triple DES to increase the key size.

Topics discussed in this section:


6.4.1 Double DES
6.4.4 Triple DES

6.58
6.4.2 Triple DES
Figure 6.16 Triple DES with two keys

6.59
6.4.2 Continuous

Triple DES with Three Keys


The possibility of known-plaintext attacks on triple DES
with two keys has enticed some applications to use triple
DES with three keys. Triple DES with three keys is used
by many applications such as PGP (See Chapter 16).

6.60
6-5 Security of DES

DES, as the first important block cipher, has gone


through much scrutiny. Among the attempted attacks,
three are of interest: brute-force, differential
cryptanalysis, and linear cryptanalysis.

Topics discussed in this section:


6.5.1 Brute-Force Attack
6.5.2 Differential Cryptanalysis
6.5.3 Linear Cryptanalysis

6.61
6.5.1 Brute-Force Attack

We have discussed the weakness of short cipher key in


DES. Combining this weakness with the key complement
weakness, it is clear that DES can be broken using 255
encryptions.

6.62
Block Cipher Design Principles

 basic principles still like Feistel in 1970’s


 number of rounds
 more is better, exhaustive search best attack
 function f:
 provides “confusion”, is nonlinear, avalanche
 key schedule
 complex subkey creation, key avalanche
Modes of Operation

 block ciphers encrypt fixed size blocks


 eg. DES encrypts 64-bit blocks, with 56-bit key
 need way to use in practise, given usually have
arbitrary amount of information to encrypt
 four were defined for DES in ANSI standard
ANSI X3.106-1983 Modes of Use
 subsequently now have 5 for DES and AES
 have block and stream modes
USE OF MODERN BLOCK CIPHERS

Symmetric-key encipherment can be done using


modern block ciphers. Modes of operation have been
devised to encipher text of any size employing either
DES or AES.

Topics discussed in this section:


1 Electronic Codebook (ECB) Mode
2 Cipher Block Chaining (CBC) Mode
3 Cipher Feedback (CFB) Mode
4 Output Feedback (OFB) Mode
5 Counter (CTR) Mode

8.65
8-1 Continued

Figure 8.1 Modes of operation

8.66
8.1.1 Electronic Codebook (ECB) Mode

The simplest mode of operation is called the electronic


codebook (ECB) mode.

Figure 8.2 Electronic codebook (ECB) mode

8.67
8.1.1 Continued

Example 8.1
It can be proved that each plaintext block at Alice’s site is exactly
recovered at Bob’s site. Because encryption and decryption are
inverses of each other,

Example 8.2
This mode is called electronic codebook because one can
precompile 2K codebooks (one for each key) in which each
codebook has 2n entries in two columns. Each entry can list the
plaintext and the corresponding ciphertext blocks. However, if K
and n are large, the codebook would be far too large to precompile
and maintain.
8.68
8.1.1 Continued
Example 8.3

Assume that Eve works in a company a few hours per month (her
monthly payment is very low). She knows that the company uses
several blocks of information for each employee in which the
seventh block is the amount of money to be deposited in the
employee’s account. Eve can intercept the ciphertext sent to the
bank at the end of the month, replace the block with the
information about her payment with a copy of the block with the
information about the payment of a full-time colleague. Each
month Eve can receive more money than she deserves.

8.69
Advantages and Limitations of ECB

 repetitions in message may show in


ciphertext
 if aligned with message block
 particularly with data such graphics
 or with messages that change very little,
which become a code-book analysis problem
 weakness due to encrypted message
blocks being independent
 main use is sending a few blocks of data
8.1.2 Cipher Block Chaining (CBC) Mode

In CBC mode, each plaintext block is exclusive-ored with


the previous ciphertext block before being encrypted.
Figure 8.3 Cipher block chaining (CBC) mode

8.71
8.1.2 Continued
Figure 8.3 Cipher block chaining (CBC) mode

8.72
8.1.2 Continued
Example 8.4
It can be proved that each plaintext block at Alice’s site is
recovered exactly at Bob’s site. Because encryption and decryption
are inverses of each other,

Initialization Vector (IV)


The initialization vector (IV) should be known by the
sender and the receiver.

8.73
8.1.2 Continued

Error Propagation
In CBC mode, a single bit error in ciphertext block Cj
during transmission may create error in most bits in
plaintext block Pj during decryption.

8.74
Advantages and Limitations of CBC

 each ciphertext block depends on all message blocks


 thus a change in the message affects all ciphertext
blocks after the change as well as the original block
 need Initial Value (IV) known to sender & receiver
 however if IV is sent in the clear, an attacker can change bits of
the first block, and change IV to compensate
 hence either IV must be a fixed value (as in EFTPOS) or it must
be sent encrypted in ECB mode before rest of message
 at end of message, handle possible last short block
 by padding either with known non-data value (eg nulls)
 or pad last block with count of pad size
 eg. [ b1 b2 b3 0 0 0 0 5] <- 3 data bytes, then 5 bytes pad+count
8.1.3 Cipher Feedback (CFB) Mode
In some situations, we need to use DES or AES as secure
ciphers, but the plaintext or ciphertext block sizes are to
be smaller.
Figure 8.4 Encryption in cipher feedback (CFB) mode

8.76
8.1.3 Continued

Note
In CFB mode, encipherment and decipherment use
the encryption function of the underlying block
cipher.

The relation between plaintext and ciphertext blocks is


shown below:

8.77
8.1.3 Continued

CFB as a Stream Cipher

Figure 8.5 Cipher feedback (CFB) mode as a stream cipher

8.78
Advantages and Limitations of CFB

 appropriate when data arrives in


bits/bytes
 most common stream mode
 limitation is need to stall while do block
encryption after every n-bits
 note that the block cipher is used in
encryption mode at both ends
 errors propogate for several blocks after
the error
18.1.4 Output Feedback (OFB) Mode

In this mode each bit in the ciphertext is independent of


the previous bit or bits. This avoids error propagation.
Figure 8.6 Encryption in output feedback (OFB) mode

8.80
8.1.4 Continued
OFB as a Stream Cipher

Figure 8.7 Output feedback (OFB) mode as a stream cipher

8.81
Advantages and Limitations of OFB

 used when error feedback a problem or where need to


encryptions before message is available
 superficially similar to CFB
 but feedback is from the output of cipher and is
independent of message
 a variation of a Vernam cipher
 hence must never reuse the same sequence (key+IV)
 sender and receiver must remain in sync, and some
recovery method is needed to ensure this occurs
 originally specified with m-bit feedback in the standards
 subsequent research has shown that only OFB-64
should ever be used
8.1.5 Counter (CTR) Mode

In the counter (CTR) mode, there is no feedback. The


pseudorandomness in the key stream is achieved using a
counter.
Figure 8.8 Encryption in counter (CTR) mode

8.83
8.1.5 Continued

Figure 8.9 Counter (CTR) mode as a stream cipher

8.84
Advantages and Limitations of CTR

 efficiency
 can do parallel encryptions
 in advance of need
 good for bursty high speed links
 random access to encrypted data blocks
 provable security (good as other modes)
 but must ensure never reuse key/counter
values, otherwise could break (cf OFB)
8.1.5 Continued

Comparison of Different Modes

8.86
Summary

have discussed:
 block cipher design principles
 DES
 details
 strength
 Modes of Operation
 ECB, CBC, CFB, OFB, CTR

You might also like