18CS744 Module 1 Feistel Structure and DES (1)
18CS744 Module 1 Feistel Structure and DES (1)
2
3
MODULE 1
BLOCK CIPHERS AND THE DATA
ENCRYPTION STANDARD
TECHNIQUES
4
◼ The objective of this chapter is to illustrate the
principles of modern symmetric ciphers.
◼ For this purpose, we focus on the most widely used
symmetric cipher: the Data Encryption Standard
(DES).
◼ A detailed study of DES provides an understanding of
the principles used in other symmetric ciphers.
◼ This chapter begins with a discussion of the general
principles of symmetric block ciphers followed by a
detailed study of DES.
5
◼ A block cipher is an encryption/decryption scheme
in which a block of plaintext is treated as a whole and
used to produce a ciphertext block of equal length.
◼ Many block ciphers have a Feistel structure. Such a
structure consists of a number of identical rounds of
processing. In each round, a substitution is performed
on one half of the data being processed, followed by
a permutation that interchanges the two halves.
◼ The original key is expanded so that a different key is
used for each round.
6
◼ The Data Encryption Standard (DES) has been the
most widely used encryption algorithm until
recently. It exhibits the classic Feistel structure.
◼ DES uses a 64-bit block and a 56-bit key.
◼ Two important methods of cryptanalysis are
differential cryptanalysis and linear cryptanalysis.
◼ DES has been shown to be highly resistant to
these two types of attack.
7
BLOCK CIPHER PRINCIPLES
12
MOTIVATION FOR THE FEISTEL CIPHER
STRUCTURE
13
◼ The following examples illustrate nonsingular and
singular transformations for n = 2.
15
◼ A 4-bit input produces one of 16 possible input states,
which is mapped by the substitution cipher into a
unique one of 16 possible output states, each of which
is represented by 4 ciphertext bits.
◼ The encryption and decryption mappings can be
defined by a tabulation, as shown in Table 3.1.
◼ This is the most general form of block cipher and can
be used to define any reversible mapping between
plaintext and ciphertext.
◼ Feistel refers to this as the ideal block cipher, because
it allows for the maximum number of possible16
encryption mappings from the plaintext block
17
Problem with Feistel - Ideal block cipher:
◼ Ideal block cipher is like substitution cipher.
◼ As the block size is small, Vulnerable to statistical analysis.
◼ For large block size , ideal block building implementation
and ideal block storing is infeasible.
19
◼ Substitution- Each plaintext element or group of
elements is replaced by a corresponding ciphertext
element or group of elements. Here the Replacement
is unique.
◼ Permutation - A sequence of plaintext elements is
replaced by a permutation of that sequence.
◼ That is, no elements are added or deleted or replaced
in the sequence, rather the order in which the
elements appear in the sequence is changed.
20
◼ Claude Shannon’s 1949 paper has the key ideas
that led to the development of modern block
ciphers.
◼ Critically, it was the technique of layering groups
of S-boxes separated by a larger P-box to form the
S-P network, a complex form of a product cipher.
◼ He also introduced the ideas of confusion and
diffusion, notionally provided by S-boxes and P-
boxes (in conjunction with S-boxes).
21
DIFFUSION AND CONFUSION
22
◼ More practically Shannon suggested combining
elements to obtain:
◼ diffusion – dissipates statistical structure of
plaintext over bulk of ciphertext
◼ confusion – makes relationship between
ciphertext and key as complex as possible.
23
◼DIFFUSION
The statistical structure of the plaintext is
dissipated into long-range statistics of the
ciphertext.
◼ This is achieved by having each plaintext digit
affect the derivation of the value of several
ciphertext digits.
◼ Message M=m1m2m3…. mk consecutive letters are
added to derive the letter of ciphertext yn
25
◼ The mechanism of diffusion seeks to make the
statistical relationship between the plaintext
and ciphertext as complex as possible in order
to thwart attempts to deduce the key.
◼ Confusion seeks to make the relationship
between the statistics of the ciphertext and
the value of the encryption key as complex as
possible, again to thwart attempts to discover the
key.
26
FEISTEL CIPHER STRUCTURE
27
28
◼ Such a network takes a block of the plaintext and
the key as inputs, and applies several alternating
rounds or layers of substitution boxes (S-boxes)
and permutation boxes (P-boxes) to produce
the ciphertext block.
◼ The S-boxes and P-boxes transform (sub-)blocks of
input bits into output bits.
◼ It is common for these transformations to be
operations that are efficient to perform in hardware,
such as exclusive or (XOR) and bitwise rotation.
◼ The key is introduced in each round, usually in the29
31
32
◼ All rounds have the same structure. A substitution
is performed on the left half of the data.
◼ This is done by applying a round function F to the
right half of the data and then taking the exclusive-
OR of the output of that function and the left half of
the data.
◼ The round function has the same general structure
for each round but is parameterized by the round
subkey Ki
33
◼ Li = Ri-1
◼ Ri = Li-1 F(Ri-1 , Ki )
34
◼ The exact realization of a Feistel network
depends on the choice of the following
parameters and design features:
◼ Block size - increasing size improves
security, but slows cipher. The greater security
is achieved by greater diffusion.
◼ Traditionally, a block size of 64 bits has been
considered a reasonable tradeoff and was
nearly universal in block cipher design.
However, the new AES uses a 128-bit block 35
size.
• Key size - increasing size improves security, makes
exhaustive key searching harder.
◼ The greater security is achieved by greater resistance
to brute-force attacks and greater confusion.
◼ Key sizes of 64 bits or less are now widely considered
to be inadequate, and 128 bits has become a
common size.
37
• Fast software en/decryption - In many cases,
encryption is embedded in applications or utility
functions in such a way as to exclude a hardware
implementation.
• Accordingly, the speed of execution of the
algorithm becomes a concern.
• Ease of analysis - for easier validation &
testing of strength
• if the algorithm can be concisely and clearly
explained, it is easier to analyze that algorithm
for cryptanalytic vulnerabilities and therefore
develop a higher level of assurance as to its
strength. 38
FEISTEL DECRYPTION ALGORITHM
39
◼ To see that the same algorithm with a reversed
key order produces the correct result, Figure 3.3
shows the encryption process going down the
left-hand side and the decryption process going
up the right-hand side for a 16-round algorithm.
40
41
42
◼ For clarity, we use the notation LEi and REi and
for data traveling through the encryption
algorithm and and for LDi and RDi data traveling
through the decryption algorithm.
◼ Let the output of the ith encryption round be LEi
|| REi (LEi concatenated with REi ).Then the
corresponding output of the (16 – i) th
decryption round is REi || LEi or, equivalently,
LD16-i and RD16-i .
43
◼ After the last iteration of the encryption process,
the two halves of the output are swapped, so that
the ciphertext is RE16 || LE16
◼ The output of that round is the ciphertext.
◼ Now take that ciphertext and use it as input to the
same algorithm.
◼ The input to the first round is RE16 || LE16 , which
is equal to the 32-bit swap of the output of the
sixteenth round of the encryption process.
44
◼ Now we would like to show that the output of
the first round of the decryption process is equal
to a 32-bit swap of the input to the sixteenth
round of the encryption process.
◼ First, consider the encryption process. We see
that
45
46
◼ Thus, we have LD1 = RE15 and RD1 = LE15
◼ Therefore, the output of the first round of the
decryption process is RE15 || LE15 which is the
32-bit swap of the input to the sixteenth round
of the encryption. This correspondence holds all
the way through the 16 iterations, as is easily
shown.
47
◼ We can cast this process in general terms. For
the ith iteration of the encryption algorithm
◼ Rearranging terms:
48
◼ Thus, we have described the inputs to the ith
iteration as a function of the outputs, and these
equations confirm the assignments shown in the
right-hand side of Figure 3.3.
process.
◼ To help clarify the preceding concepts, let us look at a
specific example (Figure 3.4) and focus on the
fifteenth round of encryption, corresponding to the
second round of decryption.
◼ Suppose that the blocks at each stage are 32 bits
(two 16-bit halves) and that the key size is 24 bits.
◼ Suppose that at the end of encryption round
fourteen, the value of the intermediate block (in
hexadecimal) is DE7F03A6. Also assume that the
value of is K15 is 12DE52
50
LE RE 03A6
14 14 LD RD
2 2
03A6
RE
LE
15 LD RD
15
1 1
DATA ENCRYPTION STANDARD (DES)
52
DES – HISTORY
◼ In the late 1960s, IBM set up a research project in
computer cryptography led by Horst Feistel.
◼ The project concluded in 1971 with the development of
the LUCIFER algorithm. LUCIFER is a Feistel block cipher
that operates on blocks of 64 bits, using a key size of 128
bits.
◼ Because of the promising results produced by the
LUCIFER project, IBM embarked on an effort, headed by
Walter Tuchman and Carl Meyer, to develop a marketable
commercial encryption product that ideally could be
implemented on a single chip.
◼ It involved not only IBM researchers but also outside
53
consultants and technical advice from NSA.
◼ The outcome of this effort was a refined version of
LUCIFER that was more resistant to cryptanalysis
but that had a reduced key size of 56 bits, to fit on
a single chip.
◼ In 1973, the National Bureau of Standards (NBS)
issued a request for proposals for a national cipher
standard. IBM submitted the modified LUCIFER.
◼ It was by far the best algorithm proposed and was
adopted in 1977 as the Data Encryption Standard.
54
DES DESIGN CONTROVERSY
minutes.
◼ The algorithm is believed to be practically
secure in the form of Triple DES, although there
are theoretical attacks.
◼ In recent years, the cipher has been superseded
by the Advanced Encryption Standard
(AES). DES has flourished and is widely used,
especially in financial applications.
◼ It is still standardized for legacy systems, with
either AES or triple DES for new applications.
56
57
58
59
◼ The next step is to permute the key using the
PC-1 table below. This is, the first bit of our 56-
bit permutation key will be the 57th bit of our
original key, and so on.
60
62
63
Schedule of Left
shifts
64
Permuted Choice Two
(PC-2)
65
66
67
68
69
70
Permutation
Function (P)
71
72
Inverse Initial
Permutation IP-1 73
74
Figure 3.5 General Depiction of DES Encryption
Algorithm
75
76
77
78
◼ Initial and Final Permutations Figure 3.2 shows
the initial and final permutations (P-boxes).
◼ Each of these permutations takes a 64-bit input
and permutes them according to a predefined
rule.
79
DES ROUND STRUCTURE
82
83
84
85
86
87
DES KEY SCHEDULE