Presentation is loading. Please wait.

Presentation is loading. Please wait.

Networks and Communication Systems Department

Similar presentations


Presentation on theme: "Networks and Communication Systems Department"— Presentation transcript:

1 Networks and Communication Systems Department
1 NET 311D INFORMATION SECURITY Networks and Communication Systems Department TA. Anfal AlHazzaa TUTORIAL 3 (How DES Works in Detail )

2 Recalling 1 Networks and Communication Systems Department

3 Cryptography Categories
3 Networks and Communication Systems Department

4 Symmetric Key Symmetric Key Traditional Ciphers Symmetric Key
4 Symmetric Key Symmetric Key Modern Round Ciphers Traditional Ciphers Simple Modern Cipher Networks and Communication Systems Department

5 Modern Round Ciphers (bit orinted)
5 Symmetric Key Modern Round Ciphers Data Encryption Standard (DES) Advanced Encryption Standard (AES) Networks and Communication Systems Department

6 Example: How DES Works in Detail
6 Example: Let M be the plain text message M = ABCDEF After convert it to binary (Base 16) M = Networks and Communication Systems Department

7 Example: How DES Works in Detail cont.
7 Let K be the hexadecimal key  K = BBCDFF1. After convert it to binary (Base 16)  K = DES operates on the 64-bit blocks using key sizes of bits. The keys are actually stored as being 64 bits long, but every 8th bit in the key is not used (i.e. bits numbered 8, 16, 24, 32, 40, 48, 56, and 64). Networks and Communication Systems Department

8 Data Encryption Standard (DES)
8 Networks and Communication Systems Department

9 Step 1: Create 16 subkeys, each of which is 48-bits long.
9 The 64-bit key is permuted according to the following table, PC-1 ( to make it 56 bits) From the original 64-bit key K = we get the 56-bit permutation K+ = 001111 Networks and Communication Systems Department

10 How to perform the permutation ?
The 64-bit key is permuted according to the following table, PC-1 ( to make it 56 bits) K= First : we make a table of the bits , Second : we number these bits 1 2 3 4 5 6 7 8 The same way apply on slide 14,18,21,28,30 the only differences is the permutation table 1 9 16 17 24 25 32 33 40 41 48 49 56 57 64

11 Con. Third : we rearrange the bits according to given table here the table is PC-1 : for example the bit number 57 will move to bit number 1 , bit number 49 will move to bit number 2 , bit number 41 will be in number 3 and so on .

12 Con. Forth : we will make new table called K+ based on these new arrangement Original key K+ 1 FINALLY The key will be 56 bit K+ =

13 Step 1: Create 16 subkeys, each of which is 48-bits long.
10 Next, split this key into left and right halves, C0 and D0, where each half has 28 bits. Example: From the permuted key K+, we get K+ = | C0 = D0 = Networks and Communication Systems Department

14 Step 1: Create 16 subkeys, each of which is 48-bits long.
11 With C0 and D0 defined, we now create sixteen blocks Cn and Dn, 1<=n<=16. Each pair of blocks Cn and Dn is formed from the previous pair Cn-1 and Dn- 1, respectively, for n = 1, 2, ..., 16, Using the following schedule of "left shifts" of the previous block. To do a left shift, move each bit one place to the left, except for the first bit, which is cycled to the end of the block. Networks and Communication Systems Department

15 Step 1: Create 16 subkeys, each of which is 48-bits long.
12 Example: From original pair C0 and D0 we obtain: C0 = D0 = C1 = D1 = C2 = D2 = C3 = D3 = Networks and Communication Systems Department

16 Step 1: Create 16 subkeys, each of which is 48-bits long.
13 Networks and Communication Systems Department

17 Step 1: Create 16 subkeys, each of which is 48-bits long.
14 We now form the keys Kn, for 1<=n<=16, by applying the following permutation table to each of the concatenated pairs CnDn. Each pair has 56 bits, but PC-2 only uses 48 of these. Example: For the first key we have C1D1 = which, after we apply the permutation PC-2, becomes K1 = 110010 Networks and Communication Systems Department

18 Step 1: Create 16 subkeys, each of which is 48-bits long.
15 Networks and Communication Systems Department

19 Review Step 1 1 Converting the key from hexadecimal to binary 2
Permuting the 64-bit key to make it 56 bits 3 Splitting the key into left and right halves C0 and D0, 4 Creating sixteen blocks Cn and Dn by shifting 5 Permuting each of the concatenated pairs Cn Dn

20 (Review) Step 1: Create 16 subkeys, each of which is 48-bits long
Convert the key to binary (16 base)  64 bits The 64-bit key is permuted according to the PC-1 table ( to make it 56 bits) Split this key into left and right halves, C0 and D0, where each half has 28 bits. Using the schedule of "left shifts“, we now create sixteen blocks from C0 and D0 We now form the keys Kn, for 1<=n<=16, by applying the permutation table (PC-2) to each of the concatenated pairs CnDn. Now : we have 16 subkeys (48 bits) TA. Anfal AlHazzaa -Networks and Communication Systems Department

21 Data Encryption Standard (DES)
17 Networks and Communication Systems Department

22 Step 2: Encode each 64-bit block of data
18 There is an initial permutation IP of the 64 bits of the message data M. This rearranges the bits according to the following table Example: Applying the initial permutation to the block of text M, given previously, we get M = IP = Networks and Communication Systems Department

23 Step 2: Encode each 64-bit block of data
19 Next divide the permuted block IP into a left half L0 of 32 bits, and a right half R0 of 32 bits. Example: From IP, we get L0 and R0 IP = | L0 = R0 = Networks and Communication Systems Department

24 Step 2: Encode each 64-bit block of data
20 Then for n going from 1 to 16 we calculate Ln = Rn-1 Rn = Ln f(Rn-1,Kn) Example: For n = 1, we have L1 = R0 = R1 = L0 + f(R0,K1) K1 = Networks and Communication Systems Department

25 Step 2: Encode each 64-bit block of data
21 To Calculate function f: 1. We first expand each block Rn-1 from 32 bits to 48 bits(This is done by using a selection table that repeats some of the bits in Rn-1. We'll call the use of this selection table the function E ,Thus E(Rn-1) has a 32 bit input block, and a 48 bit output block) Example: We calculate E(R0) from R0 as follows: R0 = E(R0) = 010101 Networks and Communication Systems Department

26 Step 2: Encode each 64-bit block of data
22 To Calculate function f: 2. Next in the f calculation, we XOR the output E(Rn-1) with the key Kn: Kn E(Rn-1). Example: For K1 , E(R0), we have K1 = E(R0) = K1+E(R0) = Networks and Communication Systems Department

27 Step 2: Encode each 64-bit block of data
23 To Calculate function f: 3. We now have 48 bits, or eight groups of six bits. - We now have 48 bits, or eight groups of six bits. Write the previous result, which is 48 bits, in the form: Kn E(Rn-1) =B1B2B3B4B5B6B7B8, where each Bi is a group of six bits. We now calculate S1(B1)S2(B2)S3(B3)S4(B4)S5(B5)S6(B6)S7(B7)S8(B8) where Si(Bi) referres to the output of the i-th S box. Networks and Communication Systems Department

28 Networks and Communication Systems Department

29 Step 2: Encode each 64-bit block of data
25  S1(011000)  Answer: 0101  Hence S1(011011) = 0101. Networks and Communication Systems Department

30 Step 2: Encode each 64-bit block of data
26  S2(010001) S2  Answer: 1100  Hence S1(010001) = 1100 Networks and Communication Systems Department

31 Step 2: Encode each 64-bit block of data
27 Example: For the first round, we obtain as the output of the eight S boxes: K1 + E(R0) = S1(B1)S2(B2)S3(B3)S4(B4)S5(B5)S6(B6)S7(B7)S8(B8) = Networks and Communication Systems Department

32 Step 2: Encode each 64-bit block of data
28 To Calculate function f: 4. The final stage in the calculation of f is to do a permutation P of the S-box output to obtain the final value of f: f = P(S1(B1)S2(B2)...S8(B8)) Example: From the output of the eight S boxes:  S1(B1)S2(B2)S3(B3)S4(B4)S5(B5)S6(B6)S7(B7)S8(B8) =  f = Networks and Communication Systems Department

33 Step 2: Encode each 64-bit block of data
29  R1 = L0 + f(R0 , K1 ) = = For round 1 (n=1) L1 = R0 = R1 = L0 + f(R0,K1) = Networks and Communication Systems Department

34 Step 2: Encode each 64-bit block of data
30 In the next round(n-2) , we will have L2 = R1, which is the block we just calculated, and then we must calculate R2 =L1 + f(R1, K2), and so on for 16 rounds. At the end of the sixteenth round we have the blocks L16 and R16. We then reverse the order of the two blocks into the 64-bit block R16L16 Apply a final permutation IP-1 as defined by the following table: - Networks and Communication Systems Department

35 Step 2: Encode each 64-bit block of data
31 Example: If we process all 16 blocks using the method defined previously, we get, on the 16th round, L16 = R16 = We reverse the order of these two blocks and apply the final permutation to  R16L16 =  IP-1 = Networks and Communication Systems Department

36 Step 2: Encode each 64-bit block of data
32 which in hexadecimal format is 85E813540F0AB405. This is the encrypted form of M = ABCDEF  C = 85E813540F0AB405. Decryption is simply the inverse of encryption, following the same steps as above, but reversing the order in which the subkeys are applied. Networks and Communication Systems Department

37 Review step 2 1 Converting the message from hexadecimal to binary 2
Initial permutation IP 3 Dividing the permuted block IP into a left half L0 of 32 bits, and a right half R0 of 32 bits.

38 Con. Review The Feistel (F) function
1 Calculating Ln = Rn-1 Rn = Ln-1 + f(Rn-1,Kn) 2 Looping 16 times 3 Expanding each block Rn-1 4 XORing the output E(Rn-1) with the key Kn. 5 CalculateingS1(B1)S2(B2)S3(B3)S4(B4)S5(B5)S6(B6)S7(B7)S8(B8)using S-box 6 Permutating the S-box output to obtain the final value of f. 7 Reversing the order of the two blocks R16L16 8 Final permutation IP-1 9 Converting the IP-1 from binary to hexadecimal to get the cipher text

39 (Review) Step 2: Encode each 64-bit block of data
33 Convert message to binary (base 16)  64 bits Apply the initial permutation to the block of text M. Divide the permuted block IP into a left half L0 of 32 bits, and a right half R0 of 32 bits. Then for n going from 1 to 16 we calculate Ln = Rn-1 Rn = Ln-1 + f(Rn-1,Kn) To calculate f: Expand each block Rn-1 from 32 bits to 48 bits(using selection table E) Kn E(Rn-1)  48 bits Where each Bi is a group of six bits, calculate S1(B1)S2(B2)S3(B3)S4(B4)S5(B5)S6(B6)S7(B7)S8(B8) Do a permutation P of the S-box output to obtain the final value of f Repeat these steps 16 times 5. At the end , Reverse the order of these two blocks ( L16, R16 ) and apply the final permutation. TA. Maram AlMuhareb- Networks and Communication Systems Department

40 References 34 The DES Algorithm Illustrated. (n.d.). Retrieved 2015, from Networks and Communication Systems Department


Download ppt "Networks and Communication Systems Department"

Similar presentations


Ads by Google