Index

Data Encryption Standard (DES)

DES is a block cipher which has a block size of 64 bits and an effective key size of 56 bits. DES is an example of a sixteen round Feistel cipher. One consequence of this is that encryption and decryption use the same procedure but with reversed round keys. We show encryption here. The DES standard numbers bits such that the most significant bit is numbered as bit 1 which means that a block's least significant bit is numbered as bit 64. This convention is adopted here.

Before the sixteen rounds there is an Initial Permutation (IP), and after the rounds there is another permutation which is the inverse of the Initial Permutation (IP-1). Each of the sixteen rounds comprises a 32-to-48-bit expansion (E), the introduction of 48-bit key material with an XOR (exclusive-or) operation, eight 6-to-4-bit S-boxes (S), and then a 32-bit permutation (P). As it's a Feistel cipher, the input block of 64-bits is split into two 32-bit halves: left (bits 1 to 32) and right (bits 33 to 64). If we take Li to be the left-hand side of round i and Ri to be the right-hand side of the same round then, if given a round key Ki, the round function can be can be written as follows:

	
Li = Ri-1
Ri = Li-1⊕P(S(E(Ri-1)⊕Ki))
	
      

Following the last round the left and right halves are exchanged.

Initial and Final Permutation

IP

The 64-bit block input is fed into an initial permutation (IP). The table below shows this 64-bit permutation. The table is constructed so that the first row contains entries 1 (0+1) to 8 (0+8) and the second row entries 9 (8+1) to 16 (8+8), and so on. If the nth table entry contains 'm' then input bit 'm' is wired to output bit 'n'. As an example, we see that input bit number 58 is wired to output bit 1. Note that most of the tables in this document will have this format with the exception of the S-boxes.

IP
12345678
0585042342618102
8605244362820124
16625446383022146
24645648403224168
3257494133251791
40595143352719113
48615345372921135
56635547393123157

The table can also be represented by a wiring diagram as follows. Here the input is at the top of the diagram and the output is at the bottom, and the leftmost bit is bit 1.

Inverse Initial Permutation (IP-1)

The final stage is the inversion of the initial permutation. Since the initial permutation was known as IP, the inverse is known as IP-1 as IP-1(IP(x))=x. The table below defines this 64-bit permutation.

IP-1
12345678
0408481656246432
8397471555236331
16386461454226230
24375451353216129
32364441252206028
40353431151195927
48342421050185826
5633141949175725

The following diagram gives the same information as is found in the table but in the form of a wiring diagram.

Key Dependent Computation

Here we detail the round function. As described above, the computation is

	
Li = Ri-1
Ri = Li-1⊕P(S(E(Ri-1)⊕Ki))
	
      

What follows is a description of E, S, and P.

E

The block E is a 32-to-48-bit expansion. Of the 32 input bits, 16 are duplicated to give the 48-bit output. The expansion is designed to give any two neighbouring S-boxes two common input bits. The table below defines the expansion.

E
123456
03212345
6456789
128910111213
18121314151617
24161718192021
30202122232425
36242526272829
4228293031321

The following diagram gives the same information as is found in the table but in the form of a wiring diagram.

S-Boxes

The eight 6-to-4-bit S-boxes are numbered S1 to S8. The 48-bit input is fed into the boxes and a 32-bit result is output. S-box S1 is given input bits 1 to 8, and S-box S8 is given input bits 41 to 48.

If we have an input of b1b2b3b4b5b6 then we take the binary code b1b6 and use it to chose the row, then we use the binary code b2b3b4b5 to choose the column. The selected entry gives the 4-bit output of the S-box. To give an example, an input of 101010 gives row 10(2) and column 0101(5). The definition of the S-boxes now follow.

S1

S1
0123456789101112131415
01441312151183106125907
10157414213110612119538
24114813621115129731050
31512824917511314100613

S2

S2
0123456789101112131415
01518146113497213120510
13134715281412011069115
20147111041315812693215
31381013154211671205149

S3

S3
0123456789101112131415
01009146315511312711428
11370934610285141211151
21364981530111212510147
31101306987415143115212

S4

S4
0123456789101112131415
07131430691012851112415
11381156150347212110149
21069012117131513145284
33150610113894511127214

S5

S5
0123456789101112131415
02124171011685315130149
11411212471315015103986
24211110137815912563014
31181271142136150910453

S6

S6
0123456789101112131415
012 11015 9 2 6 8 013 3 414 7 511
11015 4 2 712 9 5 6 11314 011 3 8
291415 5 2 812 3 7 0 410 113116
34 3 212 9 515101114 1 7 6 0 813

S7

S7
0123456789101112131415
0411 21415 0 813 312 9 7 510 6 1
113 011 7 4 9 11014 3 512 215 8 6
21 4111312 3 7141015 6 8 0 5 9 2
361113 8 1 410 7 95 01514 2 312

S8

S8
0123456789101112131415
013 2 8 4 61511 110 9314 5 012 7
111513 810 3 7 412 5 611 014 9 2
2711 4 1 91214 2 0 6101315 3 5 8
32 114 7 410 8131512 9 0 3 5 611

P

The block P is a 32-bit permutation. The following table defines this permutation.

P
12345678
0167202129122817
811523265183110
16282414322739
2419133062211425

The following diagram gives the same information as is found in the table but in the form of a wiring diagram.

Key Schedule

The input key is a 64-bit value. Contained within the 64 bits is a 56-bit key and eight parity bits. The parity bits are added to give an odd number of 1 bits. The parity bits are removed by Permuted Choice 1 (PC1) which also splits the 56-bit key data into the two 28-bit registers C and D. A new round key is generated by rotating C and D by one or two places to the left. Just how many places is determined by the round number. From the rotated C and D registers, 48-bits of key data are extracted by Permuted Choice 2 (PC2). These 48-bits are then combined with the block data that has been output by the round expansion (E) as seen in the round function definition where Ki is the round key for round i:

	
Li = Ri-1
Li = Li-1⊕P(S(E(Ri-1)⊕Ki))
	
	

PC1

The Permuted Choice 1 (PC1) function removes the 8 parity bits from the 64-bit input and splits the 56-bits of key data into the two 28-bit registers C and D. Tables are given for the registers C and D. Here C is output bits 1 to 28, and D is output bits 29 to 56.

PC1 C
1234567
05749413325179
71585042342618
141025951433527
211911360524436
PC1 D
1234567
063554739312315
77625446383022
141466153453729
21211352820124

The same information given in the tables is shown here in a wiring diagram. Here C is the most significant 28 bits and D the least significant 28 bits.

Rotate

After PC1 the C and D registers are rotated either one or two places to the left. The number of places is a function of the round number. The table below connects the round number and the number of places to rotate.

Rotate
Round
12345678910111213141516
Place(s)1122222212222221

A rotation of one place gives the following wiring diagram:

A rotation of two places gives the following wiring diagram:

PC2

Permuted Choice 2 (PC2) extracts 48 bits of key data from the result of the rotation of registers C and D. The table below defines this operation.

PC2
123456
01417112415
63281562110
122319124268
181672720132
24415231374755
30304051453348
36444939563453
42464250362932

The same information as given in the table above is shown below in a wiring diagram.

References

L. R. Knudsen, M. J. B. Robshaw, The Block Cipher Companion. Springer, 2011.
Data Encryption Standard (DES). FIPS Publication 46-3, 1999.

Index