Top Banner
Cipher Ch3. Block Ciphers and the Data Encryption Standard Department of Computer Science Academic Year: 2017-2018 Semester: One Dr. Maytham Mustafa Hammood Cipher
40

Ch3. Block Ciphers and the Data Encryption Standard

Apr 28, 2022

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Ch3. Block Ciphers and the Data Encryption Standard

Cipher

Ch3. Block Ciphers and the Data Encryption Standard

Department of Computer ScienceAcademic Year: 2017-2018

Semester: One

Dr. Maytham Mustafa Hammood

Cipher

Page 2: Ch3. Block Ciphers and the Data Encryption Standard

Modern Block Ciphers

now look at modern block ciphers

one of the most widely used types of cryptographic algorithms

provide secrecy /authentication services

focus on DES (Data Encryption Standard)

to illustrate block cipher design principles

Cipher

Page 3: Ch3. Block Ciphers and the Data Encryption Standard

Block vs Stream Ciphers

• block ciphers process messages in blocks, each of which is then en/decrypted

• like a substitution on very big characters

– 64-bits or more

• stream ciphers process messages a bit or byte at a time when en/decrypting

Cipher

Page 4: Ch3. Block Ciphers and the Data Encryption Standard

Block vs Stream Ciphers

Cipher

Page 5: Ch3. Block Ciphers and the Data Encryption Standard

Claude Shannon and Substitution-Permutation Ciphers

Claude Shannon introduced idea of substitution-permutation (S-P) networks in 1949 paper

form basis of modern block ciphers

S-P nets are based on the two primitive cryptographic operations seen before:

substitution (S-box)

permutation (P-box)

provide confusion & diffusion of message & keyClaude Elwood Shannon (April 30, 1916 – February 24, 2001)

Cipher

Page 6: Ch3. Block Ciphers and the Data Encryption Standard

Confusion and Diffusion

• cipher needs to completely obscure statistical properties of original message

• a one-time pad does this

• more practically Shannon suggested combining S & P elements to obtain:

• diffusion – dissipates statistical structure of plaintext over bulk of ciphertext

• confusion – makes relationship between ciphertext and key as complex as possible

Cipher6

Page 7: Ch3. Block Ciphers and the Data Encryption Standard

Feistel Cipher Structure

Cipher 7

Page 8: Ch3. Block Ciphers and the Data Encryption Standard

Feistel Cipher Design Elements

block size key size number of rounds subkey generation algorithmround function fast software en/decryptionease of analysis

Cipher

Page 9: Ch3. Block Ciphers and the Data Encryption Standard

History of DES Algorithm

In 1977, the results of Tuchman’s project of

IBM was adopted as the Data Encryption

Standard by NSA (NIST).

Cipher

Page 10: Ch3. Block Ciphers and the Data Encryption Standard

DES – Initial Permutation Function

• Before first rounds, the plaintext bits are

permuted using an initial permutation. IP

IP Table

Cipher

Page 11: Ch3. Block Ciphers and the Data Encryption Standard

IP (Initial Permutation):

8 16 24 32 40 48 56

8 16 24 32 40 48 56

IP

5842 50

Cipher

Page 12: Ch3. Block Ciphers and the Data Encryption Standard

12

32 bits

32 bits32 bits 28 bits28 bits

Cipher

Page 13: Ch3. Block Ciphers and the Data Encryption Standard

Expansion

32 1 2 3 4 5

4 5 6 7 8 9

8 9 10 11 12 13

12 13 14 15 16 17

16 17 18 19 20 21

20 21 22 23 24 25

24 25 26 27 28 29

28 29 30 31 32 1

E

ExpansionExpansion

13

Cipher

Page 14: Ch3. Block Ciphers and the Data Encryption Standard

1 4 5 8 9 12 13 16 17 20 21 24 25 28 29 32

1 48

Expansion Permutation

32

48

Cipher

Page 15: Ch3. Block Ciphers and the Data Encryption Standard

1 48

X-OR with 48 bit key

1 48

48

48

48

Cipher

Page 16: Ch3. Block Ciphers and the Data Encryption Standard

S-box

1

S-box

2

S-box

3

S-box

4

S-box

5

S-box

6

S-box

7

S-box

8

1 4 5 8 9 12 13 16 17 20 21 24 25 28 29 32

1 48

S-Box Substitution

48

32

Cipher

Page 17: Ch3. Block Ciphers and the Data Encryption Standard

Cipher

Page 18: Ch3. Block Ciphers and the Data Encryption Standard

Cipher

Page 19: Ch3. Block Ciphers and the Data Encryption Standard

DES: S-Boxes (1-4)

Cipher

Page 20: Ch3. Block Ciphers and the Data Encryption Standard

DES: S-Boxes (5-8)

Cipher

Page 21: Ch3. Block Ciphers and the Data Encryption Standard

Permutation

16 7 20 21 29 12 28 17

1 15 23 26 5 18 31 10

2 8 24 14 32 27 3 9

9 13 30 6 22 11 4 25

P – Box Table

Cipher

Page 22: Ch3. Block Ciphers and the Data Encryption Standard

1 4 5 8 9 12 13 16 17 20 21 24 25 28 29 32

P-Box Permutation

32

32

1 4 5 8 9 12 13 16 17 20 21 24 25 28 29 32

Cipher

Page 23: Ch3. Block Ciphers and the Data Encryption Standard

Inverse Permutation

• Hence, at the end of the 16 rounds the inverse permutation is

applied.

IP-1 Table

Cipher

Page 24: Ch3. Block Ciphers and the Data Encryption Standard

IP-1 (Final Permutation):

8 16 24 32 40 48 56

8 16 24 32 40 48 56

Cipher

Page 25: Ch3. Block Ciphers and the Data Encryption Standard

Cipher

Page 26: Ch3. Block Ciphers and the Data Encryption Standard

• PC-157 49 41 33 25 17 9

1 58 50 42 34 26 18

10 2 59 51 43 35 27

19 11 3 60 52 44 36

63 55 47 39 31 23 15

7 62 54 46 38 30 22

14 6 61 53 45 37 29

21 13 5 28 20 12 4

Cipher

Page 27: Ch3. Block Ciphers and the Data Encryption Standard

• PC-2

14 17 11 24 1 5

3 28 15 6 21 10

23 19 12 4 26 8

16 7 27 20 13 2

41 52 31 37 47 55

30 40 51 45 33 48

44 49 39 56 34 53

46 42 50 36 29 32

Cipher

Page 28: Ch3. Block Ciphers and the Data Encryption Standard

• Iteration corresponds to left shifts:

1 2 3 4 5 6 7 8

1 1 2 2 2 2 2 2

9 10 11 12 13 14 15 16

1 2 2 2 2 2 2 1

Cipher

Page 29: Ch3. Block Ciphers and the Data Encryption Standard

Initial Key Permutation

8 16 24 32 40 48 56

8 16 24 32 40 48 56

64

Cipher

Page 30: Ch3. Block Ciphers and the Data Encryption Standard

Key Split & Shift & Compress8 16 24 32 40 48 56

Shift left by Ni Shift left by Ni

8 16 24 32 40 48 56

Ni = {1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,1}

8 16 24 32 40 48

Shift accumulates every round

K48

K56

Permuted choice 2 TableCipher

Page 31: Ch3. Block Ciphers and the Data Encryption Standard

DES Example - Key• K=581FBC94D3A452EA• P=3570E2F1BA4682C7

0101 1000 0001 1111 1011 1100 1001 0100

1101 0011 1010 0100 0101 0010 1110 1010• PC-1

C= 57 49 41 33 25 17 9 1 58 50 42 34 26 18

10 2 59 51 43 35 27 19 11 3 60 52 44 36

D = 63 55 47 39 31 23 15 7 62 54 46 38 30 22

14 6 61 53 45 37 29 21 13 5 28 20 12 4

K=

Cipher

Page 32: Ch3. Block Ciphers and the Data Encryption Standard

DES Example - Key

Cipher

Page 33: Ch3. Block Ciphers and the Data Encryption Standard

DES Example - Data• K=581FBC94D3A452EA

• P=3570E2F1BA4682C7

0011 0101 0111 0000 1110 0010 1111 0001

1011 1010 0100 0110 1000 0010 1100 0111P=

Cipher

Page 34: Ch3. Block Ciphers and the Data Encryption Standard

DES Example - DataE(R(i-1)) K(i)

S100(1001)=s1

0(9)=10= 1010

Cipher

Page 35: Ch3. Block Ciphers and the Data Encryption Standard

DES Example - Data

16 7 20 21 29 12 28 17

1 15 23 26 5 18 31 10

2 8 24 14 32 27 3 9

9 13 30 6 22 11 4 25

Cipher

Page 36: Ch3. Block Ciphers and the Data Encryption Standard

R(i) = L(i-1) P(S( E(R(i-1)) K(i) ))

DES Example - Data

Cipher

Page 37: Ch3. Block Ciphers and the Data Encryption Standard

DES Example - Data

L(i) = R(i-1)

Cipher

Page 38: Ch3. Block Ciphers and the Data Encryption Standard

DES Example - Data

Cipher

Page 39: Ch3. Block Ciphers and the Data Encryption Standard

DES Example - Data

Cipher

Page 40: Ch3. Block Ciphers and the Data Encryption Standard

DES Example - Data - Done !

Cipher