Practical No.5 DES
Practical No.5 DES
5
Aim- Study of Various block cipher. a)DES Cipher b)AES Cipher
Theory:-
THE DATA ENCRYPTION STANDARD
The most widely used encryption scheme is based on the Data Encryption Standard (DES) adopted
in 1977 by the National Bureau of Standards, now the National Institute of Standards and
Technology (NIST), as Federal Information Processing Standard 46 (FIPS PUB 46). The algorithm
itself is referred to as the Data Encryption Algorithm (DEA).7 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. The DES enjoys
widespread use. It has also been the subject of much controversy concerning how secure the DES is.
To appreciate the nature of the controversy, let us quickly review the history of the DES.
DES Encryption
The overall scheme for DES encryption is illustrated in Figure 3.5. 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.8
Looking at the left-hand side of the figure, we can see that the processing of the plaintext proceeds
in three phases. First, 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 sixteen rounds of
the same function, which involves both permutation and substitution functions. 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. 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, as shown in Figure 3.3. The right-hand portion of Figure 3.5 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 sixteen rounds, a subkey (Ki ) 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 The initial permutation and its inverse are defined by tables, as shown
in Tables 3.2a and 3.2b, respectively. The tables are to be interpreted as follows. The input to a table
consists of 64 bits numbered from 1 to 64.The 64 entries in the permutation table contain a
permutation of the numbers from 1 to 64. Each
entry in the permutation table indicates the position of a numbered input bit in the output, which also
consists of 64 bits. To see that these two permutation functions are indeed the inverse of each
other, consider the following 64-bit input M :
Li = Ri-1
Ri = Li-1 { F(Ri-1, Ki)
The round key Ki is 48 bits. The input R is 32 bits. This input R 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
(Table 3.2c).The resulting 48 bits are XORed with Ki. This 48-bit result passes through a
substitution function that produces a 32-bit output, which is permuted as defined by Table 3.2d. The
role of the S-boxes in the function F is illustrated in Figure 3.7.The substitution consists of a set of
eight S-boxes, each of which accepts 6 bits as input and produces 4 bits as output. These
transformations are defined in Table 3.3, which is
interpreted as follows: The first and last bits of the input to box Si form a 2-bit binary number to
select one of four substitutions defined by the four rows in the table for . The middle four bits select
one of the sixteen columns. The decimal value in the cell selected by the row and column is then
converted to its 4-bit representation to produce the output. For example, in S1, for input 011001, the
row is 01 (row 1) and the column is 1100 (column 12).The value in row 1, column 12 is 9, so the
output is 1001. Each row of an S-box defines a general reversible substitution. Figure 3.2 may be
useful in understanding the mapping. The figure shows the substitution for row 0
of box .
The operation of the S-boxes is worth further comment. Ignore for the moment the contribution of
the key ( ). If you examine the expansion table, you see that the 32 bits of input are split into groups
of 4 bits and then become groups of 6 bits by taking the outer bits from the two adjacent groups. For
example, if part of the input word is
... efgh ijkl mnop ...
this becomes
... defghi hijklm lmnopq ...
The outer two bits of each group select one of four possible substitutions (one row of an S-box).
Then a 4-bit output value is substituted for the particular 4-bit input (the middle four input bits). The
32-bit output from the eight S-boxes is then permuted, so that on the next round, the output from
each S-box immediately affects as many others as possible.
KEY GENERATION Returning to Figures 3.5 and 3.6, we see that a 64-bit key is used as input to
the algorithm.The bits of the key are numbered from 1 through 64; every eighth bit is ignored, as
indicated by the lack of shading in Table 3.4a.The key is first subjected to a permutation governed
by a table labeled Permuted Choice One (Table 3.4b).The resulting 56-bit key is then treated as two
28-bit quantities, labelled Co and Do . At each round,Ci-1 and Di-1 are separately subjected to a
circular left shift or (rotation) of 1 or 2 bits, as governed by Table 3.4d.These shifted values serve as
input to the next round. They also serve as input to the part labeled Permuted Choice Two (Table
3.4c), which produces a 48-bit output that serves as input to the function .
Conclusion:
The concept of DES Cipher & AES Cipher has been studied successfully.
Viva Voce:-
1. What is difference between DES and AES?
2. What is key size in DES?
3. What are disadvantages of DES?
4. What is key size in AES?