Chapter 3 Block Cipher
Chapter 3 Block Cipher
1
CHAPTER 3. BLOCK CIPHERS AND THE DATA ENCRYPTION STANDARD
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.
A stream cipher is one that encrypts a digital data stream one bit or one byte at a
time.
The Feistel Cipher
Feistel cipher is the execution of two or more simple ciphers in sequence in such a
way that the final result or product is cryptographically stronger than any of the
component ciphers.
Diffusion and Confusion
Diffusion is 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 value
of many ciphertext digits; generally this is equivalent to having each ciphertext digit be
affected by many plaintext digits.
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.
Feistel Cipher Structure
The inputs to the encryption algorithm are a plaintext block of length 2w bits and a
key K. The plaintext block is divided into two halves, L
0
and R
0
.
The two halves of the data pass through n rounds of processing and then combine to
produce the ciphertext block.
Each round i has as inputs L
i-1
and R
i-1
, derived from the previous round, as well as a
subkey K
i
, derived from the overall K.
CSE 405 - Chapter 3
2
In general, the subkeys K
i
are different from K and from each other.
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. Following this substitution, a
permutation is performed that consists of the interchange of the two halves of the data.
The exact realization of a Feistel network depends on the choice of the following
parameters and design features:
Block size: Larger block sizes mean greater security, but reduced encryption/decryption
speed for a given algorithm.
Key size: Larger key size means greater security but may decrease encryption/decryption
speed. The greater security is achieved by greater resistance to brute-force attacks and
greater confusion.
Number of rounds: The essence of the Feistel cipher is that a single round offers
inadequate security but that multiple rounds offer increasing security. A typical
size is 16 rounds.
Subkey generation algorithm: Greater complexity in this algorithm should lead
to greater difficulty of cryptanalysis.
Round function: Again, greater complexity generally means greater resistance to
cryptanalysis.
There are two other considerations in the design of a Feistel cipher:
Fast software encryption/decryption: The speed of execution of the algorithm
becomes a concern.
Ease of analysis: if the algorithm can be concisely and clearly explained, it is
easier to analyze that algorithm for cryptanalytic vulnerabilities
CSE 405 - Chapter 3
3
CSE 405 - Chapter 3
4
Feistel Decryption Algorithm
The process of decryption with a Feistel cipher is essentially the same as the
encryption process. The rule is as follows: Use the ciphertext as input to the algorithm,
but use the subkeys K
i
in reverse order. That is, use K
n
in the first round, K
n-1
in the
second round, and so on until K
1
is used in the last round.
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
LE
16
= RE
15
RE
16
= LE
15
x F(RE
15
, K
16
)
On the decryption side,
LD
1
= RD
0
= LE
16
= RE
15
RD
1
= LD
0
x F(RD
0
, K
16
)
= RE
16
x F(RE
15
, K
16
)
= [LE
15
x F(RE
15
, K
16
)] x F(RE
15
, K
16
)
The XOR has the following properties:
[A x B] x C = A x [B x C]
D x D = 0
E x 0 = E
CSE 405 - Chapter 3
5
Thus, we have LD
1
= RE
15
and RD
1
= LE
15
. Therefore, the output of the first
round of the decryption process is LE
15
||RE
15
, 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. We can cast this process in general terms. For the ith
iteration of the encryption algorithm,
LE
i
= RE
i-1
RE
i
=LE
i-1
x F(RE
i-1
, K
i
)
Rearranging terms,
RE
i-1
= LE
i
LE
i-1
= RE
i
x F(RE
i-1
, K
i2
= RE
i
x F(LE
i
, K
i
)
3.2. The Data Encryption Standard
The most widely used encryption scheme is based on the Data Encryption
Standard (DES) adopted in 1977 by the National Institute of Standards and Technology
(NIST).
The algorithm itself is referred to as the Data Encryption Algorithm (DEA). For
DES, data are encrypted in 64-bit blocks using a 56-bit key. The algorithm transforms
64-bit input in a series of steps into a 64-bit output. The same steps, with the same key,
are used to reverse the encryption.
DES Encryption
As with any encryption scheme, there are two inputs to the encryption function:
the plaintext to be encrypted and the key. In this case, the plaintext must be 64 bits in
length and the key is 56 bits in length.
CSE 405 - Chapter 3
6
CSE 405 - Chapter 3
7
Looking at the left-hand side of the figure, the processing of the plaintext proceeds
in three phases.
1. The 64-bit plaintext passes through an initial permutation (IP) that
rearranges the bits to produce the permuted input. This is followed by a phase
consisting of 16 rounds of the same function, which involves both permutation
and substitution functions.
2. The output of the last (sixteenth) round consists of 64 bits that are a function of
the input plaintext and the key. The left and right halves of the output are
swapped to produce the preoutput.
3. Finally, the preoutput is passed through a permutation (IP
-1
) that is the inverse
of the initial permutation function, to produce the 64-bit ciphertext. With the
exception of the initial and final permutations, DES has the exact structure of a
Feistel cipher
The right-hand portion shows the way in which the 56-bit key is used. Initially, the
key is passed through a permutation function. Then, for each of the 16 rounds, a subkey
(K
i
) is produced by the combination of a left circular shift and a permutation. The
permutation function is the same for each round, but a different subkey is produced
because of the repeated shifts of the key bits.
Initial Permutation IP:
First step of the data computation
IP reorders the input data bits
Even bits to LH half, Odd bits to RH half
Quite regular in structure (easy in h/w)
see text Table 3.2 for all permutation functions(IP, IP
-1
,E,P)
IP(675a6967 5e5a6b5a) = (ffb2194d 004df6fb)
CSE 405 - Chapter 3
8
CSE 405 - Chapter 3
9
Details of Single Round:
The left and right halves of each 64-bit intermediate value are treated as separate 32-
bit quantities, labeled L (left) and R (right).
the overall processing at each round can be summarized in the following formulas:
L
i
= R
i-1
R
i
= L
i-1
x F(R
i-1
, K
i
)
The round key K
i
is 48 bits. The R input is 32 bits. This R input is first expanded to
48 bits by using a table that defines a permutation plus an expansion that involves
duplication of 16 of the R bits.
The resulting 48 bits are XORed with K
i
. This 48-bit result passes through a
substitution function that produces a 32-bit output.
The substitution consists of a set of eight S-boxes, each of which accepts 6 bits as
input and produces 4 bits as output.
The first and last bits of the input to box S
i
form a 2-bit binary number to select one of
four substitutions defined by the four rows in the table for S
i
. The middle four bits
select one of the sixteen columns.