32
Traditional Symmetric Key Ciphers Prepared By: Shaikh Amrin

3.traditional symmetric key ciphers

Embed Size (px)

Citation preview

Traditional Symmetric Key

Ciphers

Prepared By: Shaikh Amrin

Symmetric Key Cipher

Transposition Cipher

Substitution Cipher

Replace one char with another char in cipher text

Reorder the position of the char of plaintext

Substitution CipherSymmetric Key

Cipher

Transposition Cipher

Substitution Cipher

Mono alphabetic Cipher

Poly alphabetic Cipher

One plaintext char will replace with only one char in cipher text1. Additive2. Multiplicative3. Affine

One plaintext char will replace with many char in cipher text1. Auto key 2.

Vigenere3. Hill 4.

Vernam5. Rotor

a b c d e f g h i j k l m n o p q r s t u v w x y z0 1 2 3 4 5 6 7 8 9 1

011

12

13

14

15

16

17

18

19

20

21

22

23

24

25

Monoalphabetic Cipher

Additive cipher

Plain text: what

Key: 20Encryption

Cipher Text: qbun

Key: 20Decryption

Plain text: what

PT: w 22 22+20=42%26=16

CT: q 16-20=-4%26 = 22

PT: w

PT: h 7 7+20=27%26=1

CT: b 1-20=-19%26=7

PT: h

PT: a 0 0+20=20%26=20

CT: u 20-20=0%26=0

PT: a

PT: t 19 19+20=39%26=13

CT: n 13-20=-7%26=19

PT: t

Also known as shift or caesar cipherBrute Force or statistical attacks are possible to cryptanalyse

Multiplicative Cipher

Plain text: what

Key: 21Encryption

Cipher Text: qbun

Key: 21-1=5Decryption

Plain text: what

PT: w 22 22*21=462%26=20

CT: u 20*5=100%26 = 22

PT: w

PT: h 7 7*21=147%26=17

CT: r 17*5=85%26=7

PT: h

PT: a 0 0*21=0%26=0 CT: a 0*5=0%26=0 PT: a

PT: t 19 19*21=399%26=9

CT: j 9*5=45%26=19

PT: t

Number Inverse

1 1

3 9

5 21

7 15

9 3

11 19

15 7

17 23

19 11

21 5

23 17

25 25

Affine cipher

Plain text: what

Key pair: (21,3)Encryption

Cipher Text: xudm

PT: w 22 22*21=462%26=20+3=23%26=23

CT: x

PT: h 7 7*21=147%26=17+3=20%26=20

CT: u

PT: a 0 0*21=0%26=0+3=3%26=3 CT: d

PT: t 19 19*21=399%26=9+3=12%26=12

CT: m

Cipher Text: xudm

Key pair: (21-1,3)Decryption

Plain text: what

CT: x 23-3=20%26=20*5=100%26 = 22

PT: w

CT: u 20-3=17%26=17*5=85%26=7 PT: h

CT: d 3-3=0%26=0*5=0%26=0 PT: a

CT: m 12-3=9%26=9*5=45%26=19 PT: t

Polyalphabetic Cipher

Autokey CipherPlainText

W H A T I S T H I S

v1 22 7 0 19 8 18 19 7 8 18

v2 9 22 7 0 19 8 18 19 7 8(v1+v2)%26

5 3 7 19 1 0 11 0 15 0

CipherText

f d h t b a l a p a

Plaint text char:I is replaced with b,pt is replaced with t,l

Cipher text char:a is replaced from s,h of plain text

Playfair CipherA M R I/J N

B C D E F

G H K L O

P Q S T U

V W X Y Z

create a pair of two char from plaintext.

Conditions:1. No one pair contain same

characters. If yes then add bogus char.

2. All pairs must be of 2 length.

Rules:Let us consider i1=1st char’s row

number, j1=1st char’s column number,i2=2nd char’s row number, j2=2nd char’s column number.

3. If i1=i2 cipher will be (i1,j1+1)(i2,j2+1)

4. If j1=j2 cipher will be (i1+1,j1)(i2+1,j2)

5. Else cipher will be (i1,j2)(i2,j1)

H E L L O

H E L X L O

L C K Y O G

O H H

O H H X

G K K W

Vigenere CipherEncryption

S H E I S L A Z Y

18 7 4 8 18 11 0 25 24

2 3 1 4 2 3 1 4 2

20 10 5 12 20 14 1 3 0

U K F M U O B D A

Decryption

U K F M U O B D A

20 10 5 12 20 14 1 3 0

2 3 1 4 2 3 1 4 2

18 7 4 8 18 11 0 25 24

S H E I S L A Z Y

Hill Cipher

S H E

I S L

A Z Y

Plain Text: she is lazyAdd z to fill matrix

18 7 4

8 18 11

0 25 24

Key Matrix is:

2 1 1

1 1 2

1 0 2

Cipher Text is: Plain Text * Key %26

21 25 14

19 0 14

23 25 20

2 1 1

1 1 2

1 0 2

18 7 4

8 18 11

0 25 24

18 8 9

0 1 25

17 9 9

Inverse Key Matrix is:

18 8 9

0 1 25

17 9 9

Plain Text is: Cipher Text * Key-1 %26

21 25 14

19 0 14

23 25 20

18 7 4

8 18 11

0 25 24

S H E

I S L

A Z Y

One Time Pad or Vernam Cipher

Encryption

S H E I S L A Z Y

18 7 4 8 18 11 0 25 24

2 3 1 4 5 13 7 6 2

20 10 5 12 23 24 7 5 0

U K F M X Y H F A

Decryption

U K F M X Y H F A

20 10 5 12 23 24 7 5 0

2 3 1 4 5 13 7 6 2

18 7 4 8 18 11 0 25 24

S H E I S L A Z Y

Rotor Cipher

Plain text: beeCipher Text: BCA

Enigma Machine

• Enter C• Stecker: C to S• S permuted to Z by

rotors/reflector• Stecker: Z to L• L lights up

Transposition CipherSymmetric Key

Cipher

Transposition Cipher

Substitution Cipher

Mono alphabetic Cipher

Poly alphabetic Cipher

One plaintext char will replace with only one char in cipher text1. Additive2. Multiplicative3. Affine

One plaintext char will replace with many char in cipher text1. Auto key 2.

Vigenere3. Hill 4.

Vernam5. Rotor

Keyed Transposition Cipher

Keyless

Transposition Cipher

Keyless Transposition Cipher

Rail Fence CipherPlain Text

S H E I S L A Z Y

Row1 S E S A Y

Row2 H I L Z

Cipher Text

S E S A Y H I L Z

Cipher Text

S E S A Y H I L Z

Row1 S E S A Y

Row2 H I L Z

Plain Text

S H E I S L A Z Y

S H E

I S L

A Z Y

PT: Sheislazy

CT: siahszely

Keyless Permutation

a b c d e f g h i j k l m n o p q r s t u v w x y z

0 1 2 3 4 5 6 7 8 9 10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

2 7 9 0 21

24

12

1 10

8 3 5 13

15

16

14

18

4 6 11

17

22

25

19

23

20

c h j a v y m b k i d f n p q o s e g l r w z t x u

Keyed Transposition Cipher

Encryption

S H E I S L E A R N I N G

S H E I S L E A R N I N G Z Z

3 1 4 5 2 3 1 4 5 2 3 1 4 5 2

E S I S H A L R N E G I Z Z N

E S I S H A L R N E G I Z Z N

Key

3 1 4 5 2

Decryption

E S I S H A L R N E G I Z Z N

E S I S H A L R N E G I Z Z N

3 1 4 5 2 3 1 4 5 2 3 1 4 5 2

S H E I S L E A R N I N G Z Z

S H E I S L E A R N I N G Z Z

Key

3 1 4 5 2

Keyed Columnar Transposition Cipher or Columnar Transposition

S H E I S

L E A R N

I N G Z Z

Plain Text: she is learning

3 1 4 5 2

E S I S H

A L R N E

G I Z Z N

Cipher Text: eagsliirzsnzhen

Cipher Text: eagsliirzsnzhen

E S I S H

A L R N E

G I Z Z N

S H E I S

L E A R N

I N G Z Z

Key Inversion in Transposition Cipher

2 6 3 1 4 5 Encryption Key

1 2 3 4 5 6 Index

1 2 3 4 5 6 Index

2 6 3 1 4 5 Key

4 1 3 5 6 2 Index=Decryption Key

1 2 3 4 5 6 Sorted key

Stream and Block CipherStream Cipher Block Cipher

Encryption & Decryption are done on Single symbol at a time

A group of plain text symbol of size m (m>1) are encrypted together and creates group of cipher text together of same size.

We are having key stream

Ex: Additive Cipher, monoalphabetic substitution Cipher, Vigener Cipher

Ex: playfair Cipher,Hill Cipher, Polyalphabetic cipher

Each character in the cipher text block depends on all characters in plain text.

THANK YOU