CONCEPTS & TECHNIQUES IN CRYPTOGRAPHY - Google ...

22
CONCEPTS & TECHNIQUES IN CRYPTOGRAPHY Prof. Chittaranjan Pradhan Asst. Professor, School of Computer Engineering, KIIT University, BBSR

Transcript of CONCEPTS & TECHNIQUES IN CRYPTOGRAPHY - Google ...

CONCEPTS & TECHNIQUES

IN CRYPTOGRAPHY

Prof. Chittaranjan Pradhan

Asst. Professor, School of Computer Engineering,

KIIT University, BBSR

8/2/2011

Prof. Chittaranjan Pradhan, SCE,

KIIT University

Concepts of Cryptography

• Cryptography

• Systematic and well-structured process

• Cryptanalysis

• Trial and error process

Readable Message Cryptography Un-readable Message

Un-readable Message Cryptanalysis Readable Message

8/2/2011

Prof. Chittaranjan Pradhan, SCE,

KIIT University

Plain Text and Cipher Text

• Plain Text: Language that can be easily understood

• Cipher Text: Language that cannot be understood

N/w

Sender

Plain Text

Encryption

Cipher Text

Receiver

Plain Text

Decryption

Cipher Text

Techniques for Plain Text to

Cipher Text Conversion

• Substitution technique/ Cipher

• Each character in the PT is substituted for another character in the CT

• Transposition technique/ Cipher

• Encrypt PT by moving small pieces of the message around

• Product Cipher

• When the 2 approaches are used together

8/2/2011

Prof. Chittaranjan Pradhan, SCE,

KIIT University

8/2/2011

Prof. Chittaranjan Pradhan, SCE,

KIIT University

1. Caesar Cipher

• Proposed by Julius Caesar

• Mechanism to make a message non-understandable

• Replaces each alphabet with the one three places down

CTi= E(PTi)= PTi + 3

• PT: KIIT

• CT: NLLW

8/2/2011

Prof. Chittaranjan Pradhan, SCE,

KIIT University

2. Modified Caesar

• The CT alphabets corresponding to the original PT alphabets maynot necessarily be 3 places down the line, it can be any placesdown the line.

CTi= E(PTi)= PTi + n; 1≤n ≤25

• Once the replacement scheme is decided, it could be constant andwill be used for all other alphabets in that message.

• For each alphabet, we have 25 possibilities of replacement.

• KIIT-PNNY

8/2/2011

Prof. Chittaranjan Pradhan, SCE,

KIIT University

Brute- Force Attack

• Process where the attacker attempts to use all possiblepermutations and combinations to get PT from CT.

• CT: PNNY

• Key=1, PT:OMMX

• Key=2, PT:NLLW

• Key=3, PT:MKKV

• Key=4, PT:LJJU

• Key=5, PT:KIIT

8/2/2011

Prof. Chittaranjan Pradhan, SCE,

KIIT University

3. Mono- Alphabetic Cipher

• Random substitution

• All the instances of an alphabet will be replaced by a singlealphabet. Once, an alphabet is chosen as a replacement for a PTalphabet, can’t be used for the replacement of any other alphabet

• 26X25X24X…X2=4X1026 possibilities

• Hard to crack

• If the CT created with this scheme is short, the cryptanalyst can trydifferent attacks based on his knowledge of English.

• Cryptanalyst looks for patterns of alphabets.

• KIIT-KHHZ

8/2/2011

Prof. Chittaranjan Pradhan, SCE,

KIIT University

4. Homophonic Substitution

Cipher

• Similar to mono-alphabetic cipher.

• One PT alphabet can map to more than one CT alphabet.

• A-> D, H, P, R

• KIIT-KDHR

8/2/2011

Prof. Chittaranjan Pradhan, SCE,

KIIT University

5. Polygram Substitution Cipher

• Block of plain text transformed into block of cipher text

• Similar text patterns can yield completely different cipher textpatterns

• Block-by-block replacement

• HELLO- YUQQW

• HELL- TEUI

8/2/2011

Prof. Chittaranjan Pradhan, SCE,

KIIT University

6. Polyalphabetic Substitution

Cipher/ Vigenere Cipher

• Proposed by Leon Battish in 1568.

• The cipher uses multiple one-character keys.

• Each key encrypts one PT character.

• After all the keys are used, they are recycled.

• Period of Cipher.

• It uses a key as well as a Vigenere table for the encryption of PT

8/2/2011

Prof. Chittaranjan Pradhan, SCE,

KIIT University

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

a 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

b 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 A

c C D E F G H I J K L M N O P Q R S T U V W X Y Z A B

d D E F G H I J K L M N O P Q R S T U V W X Y Z A B C

e E F G H I J K L M N O P Q R S T U V W X Y Z A B C D

f F G H I J K L M N O P Q R S T U V W X Y Z A B C D E

g G H I J K L M N O P Q R S T U V W X Y Z A B C D E F

h H I J K L M N O P Q R S T U V W X Y Z A B C D E F G

i I J K L M N O P Q R S T U V W X Y Z A B C D E F G H

j J K L M N O P Q R S T U V W X Y Z A B C D E F G H I

k K L M N O P Q R S T U V W X Y Z A B C D E F G H I J

l L M N O P Q R S T U V W X Y Z A B C D E F G H I J K

m M N O P Q R S T U V W X Y Z A B C D E F G H I J K L

n N O P Q R S T U V W X Y Z A B C D E F G H I J K L M

o O P Q R S T U V W X Y Z A B C D E F G H I J K L M N

p P Q R S T U V W X Y Z A B C D E F G H I J K L M N O

q Q R S T U V W X Y Z A B C D E F G H I J K L M N O P

r R S T U V W X Y Z A B C D E F G H I J K L M N O P Q

s S T U V W X Y Z A B C D E F G H I J K L M N O P Q R

t T U V W X Y Z A B C D E F G H I J K L M N O P Q R S

u U V W X Y Z A B C D E F G H I J K L M N O P Q R S T

v V W X Y Z A B C D E F G H I J K L M N O P Q R S T U

w W X Y Z A B C D E F G H I J K L M N O P Q R S T U V

x X Y Z A B C D E F G H I J K L M N O P Q R S T U V W

y Y Z A B C D E F G H I J K L M N O P Q R S T U V W X

z Z 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

8/2/2011

Prof. Chittaranjan Pradhan, SCE,

KIIT University

• If the key length is lesser than the PT length; then make the lengthsame by repeating the key

• For key letter p and PT letter q, the corresponding CT letter is atthe intersection of row titled p and column titled q. Therefore, theCT could be F

• Key: orissa

• PT: bhubaneswar

• Key: orissaoriss

• CT:PYCTSNSJESJ

8/2/2011

Prof. Chittaranjan Pradhan, SCE,

KIIT University

7. Playfair Cipher

• Proposed by Charles Wheatstone in 1854.

• Named by the name of Wheatstone’s friend Lord Playfair.

• Used by British army in World War-I, and by Australian in WorldWar-II.

• Quite fast

• Used to protect important, but not very critical information.

8/2/2011

Prof. Chittaranjan Pradhan, SCE,

KIIT University

Step1. Creation and Population of

Matrix

• Uses matrix of 5X5.

• Used to store the keyword.

1. Enter the keyword in the matrix row-wise

2. Drop duplicate letters

3. Fill the remaining spaces with the rest of the English alphabets

4. Both I and J has same precedence.

Keyword: NETWORK SECURITYN E T W O

R K S C U

I Y A B D

F G H L M

P Q V X Z

8/2/2011

Prof. Chittaranjan Pradhan, SCE,

KIIT University

Step2. Encryption Process

I. The PT message is broken down into groups of 2 alphabets

II. If both alphabets are same or only one is left, add X after the alphabet

III. If one character is ‘, then that character will be replaced by the respectivecharacter in the previous pair

IV. If both the alphabets in the pair is in the same row of the matrix, replace themwith alphabets to their immediate right respectively. If the original pair is on theright side of the row , then wrapping around to the left side of the same rowhappens

V. If both the alphabets in the pair appears in the same column of the matrix,replace them with alphabets immediately below them respectively . If theoriginal pair is on the bottom side of the column, then wrapping round to thetop side of the same column happens

VI. If the alphabets are not in the same row or column, replace them with thealphabets in the same row respectively, but at the other pair of corners of therectangle defined by the original pair. The 1st encrypted alphabet of the pair isthe one that is present on the same row as the 1st PT alphabet

8/2/2011

Prof. Chittaranjan Pradhan, SCE,

KIIT University

Keyword: NETWORK SECURITY

PT: HAPPY NEW YEAR

HA PP YN EW YE AR HA PX YN EW YE AR

PT:HA

CT:VH

PT:PX

CT:QZ

PT:YN

CT:IE

PT:EW

CT:TO

PT:YE

CT:GK

PT:AR

CT:IS

PT: HAPPYNEWYEAR

CT:VHQZIETOGKIS

To decrypt the message, simply reverse the entire process. Break the

CT into pairs of letters

8/2/2011

Prof. Chittaranjan Pradhan, SCE,

KIIT University

8. Hill Cipher

• It is a type of polygraphic substitution cipher

• Invented by Lester Hill in 1929

• Works on inverse matrix theory

• It uses a key for the generation of key matrix. If the key is notgiven, then it chooses a random key

• If the determinant of the matrix is zero, then the matrix can’t beused in the Hill cipher. Discard it and try another one

8/2/2011

Prof. Chittaranjan Pradhan, SCE,

KIIT University

Steps for Encryption

1. Treat every letter in PT as a number in base 26

2. PT message is organized as a column matrix of numbers

3. Choose a key for the generation of key matrix of size n x n, where n isthe number of letters in PT. If the key length is lesser than n, thenrepeat the key to achieve that size

4. Number the letters in key similar to the PT letters. Fill the key matrix bychoosing key letters row-wise

5. Multiply PT matrix with the key matrix

6. Compute mod26 value of the matrix

7. Translate the numbers into alphabets, which is the CT

CT=(Key x PT) mod 26

8/2/2011

Prof. Chittaranjan Pradhan, SCE,

KIIT University

• PT:CNS

• C-2, N-13, S-18

2

13

18

1 2 5

3 6 7

5 8 4 X =

118

210

276

2

13

18

118

210

276

MOD 26 =

14

2

16

CT: OCQ

Steps for Decryption

• In order to decrypt, multiply the inverse matrix of the key matrixwith the CT matrix

PT= (key-1 X CT) mod 26

• CT: EIS

• Key: ANOTHERBZ

8/2/2011

Prof. Chittaranjan Pradhan, SCE,

KIIT University

8/2/2011

Prof. Chittaranjan Pradhan, SCE,

KIIT University