Transcript

Cryptography

“ You can’t make something secure if you don’t know how to break it”

- Marc Weber Tobias

Definition• Cryptography is the science of

disguising messages so that only

the intended recipient can

decipher the received message.

• Secret Writing

Scenario

Terminologies • Plain text

• Cipher text

• Encryption

• Decryption

• Cryptanalysis

• Cryptology

• Encryption: c = Ee(p)

• Decryption: p = Dd(c)

• Here p is a block of plaintext,

c is a block of ciphertext,

E is the encryption function, e is the encryption key,

D is the decryption function and d is the decryption key.

Cryptography

Cryptanalysis

• Cryptography is the art and

science of creating secret codes.

• Cryptanalysis is the art and

science of breaking those code.

Cryptanalysis Attack

Ciphertext Only

Brute-Force

Statistical

Pattern Known Plaintext

Chosen-Plaintext

Chosen-Ciphertext

Crypto-

graphy

Crypt-analys

is

Cryptology

Sym

metr

ic

Cip

hers

SubstitutionCipher

Mono-alphabetic

Polyalphabetic

TranspositionCipher

Mono-alphabetic Cipher

• Additive / Caesar / Shift Cipher

• Multiplicative Cipher

• Affine Cipher

Caesar Cipher

Representation of Character

Shift Cipher

• Encryptiono C=(P+K1) Mod 26

• Decryptiono P=(C-K1) Mod 26

https://www.youtube.com/watch?

v=fEULLhEA4Vk

• The Additive cipher replaces each

alphabet in a text by the alphabet k

positions away (in the modulo 26

sense).

• For k = 3

W H A T I S Y O U R N A M E

becomes

Z K D W L V B R X U Q D P H

Multiplicative Cipher

• Encryptiono C=(P * K1) Mod 26

• Decryptiono P=(C * K1

-1) Mod 26

Affine Cipher

• Combination of Additive and

Multiplicative

• Encryptiono C=(P * K1 + K2) Mod 26

• Decryptiono P=((C – K2 )* K1

-1) Mod 26

Cryptanalysis

• Brute-Force Attack

• Statistical Attack

• Frequency of Occurrence of letters.

(E,T,A,O,I,N,S,H,R,D……)

• Grouping of Di-gram (HE,IN,AN,IS...)

and Tri-grams (THE,ING,AND,HER…).

Poly-alphabetic Cipher

• Each occurrence of character may

have a different substitution.

• One to Many

• Vigenere Cipher , Play-fair Cipher,

Hill Cipher ,Vernam Cipher.

Vigenere Cipher

• Blaise de Vigenere, Mathematician

• Secret Key of length m (K1,K2.......,Km)

is required

• Key stream Not depend on plaintext

character.

• Encryption depends on the position of

character in the plaintext.

Example

• Plaintext : SHE IS LISTINING

• Key : PASCAL

• Cipher text : HHW KS

WXSLGNTCG

Plaintext S H E I S L I S T I N I N G

P Values 18 07 04 08 18 11 08 18 19 04 13 08 13 06

K Values 15 00 18 02 00 11 15 05 08 02 00 11 05 00

C Values 07 07 22 10 18 22 23 23 11 06 13 19 02 06

Cipher text H H W K S W X X L G N T C G

Plaintext S H E I S L I S T I N I N G

P Values 18 07 04 08 18 11 08 18 19 04 13 08 13 06

K Values 15 00 18 02 00 11 15 00 08 02 00 11 05 00

C Values 07 07 22 10 18 22 23 18 11 06 13 19 02 06

Cipher text H H W K S W X S L G N T C G

Play-fair Cipher

• Used by British army during World war

I

• Secret key made of 25 alphabet

arranged in 5*5 Matrix.

• Two step process

oCreation of matrix

o Encryption

Question (10 Marks)Dec -2012

Solution• Plaintext : SHE IS LISTINING • Key : MORNING

M O R N I

G A B C D

E F H J K

L P Q S T

U V W X YZ

Solution• SH EI SL IS TI NI NG • SH = QJ

H J

Q S

Solution• SH EI SL IS TI NI NG • EI = KM

M O R N I

G A B C D

E F H J K

Solution• SH EI SL IS TI NI NG • SL (SAME ROW)= TP

L P Q S T

Solution• SH EI SL IS TI NI NG • IS = NT• TI(SAME COLUMN) = YD

M O R N I

G A B C D

E F H J K

L P Q S T

U V W X YZ

Solution• SH EI SL IS TI NI NG • NI(SAME ROW) = IM• NG = MC

M O R N I

G A B C D

E F H J K

L P Q S T

U V W X YZ

Hill Cipher

• Lester S. Hill

• Block Cipher

• Key is square matrix of order m*m

• Key Matrix need to have

multiplicative inverse.

• Difficult to break

Example• Plain text = CATEncryption CAT = FIN

Decryption FIN = CAT

One-Time Pad• Vernam Cipher.

• Key used once can not be reused.

• Key length is equal to message

length.

• Book cipher / Running Key cipher

Plaintext V E R N E M C I P H E R

Numeric Code 21 04 17 13 00 12 02 08 15 07 04 17

Key 76 48 06 82 44 03 58 11 60 05 48 88

Sum 97 52 33 95 44 15 60 19 75 12 52 105

Mod 26 19 00 07 17 18 15 08 19 23 12 00 01

Ciphertext T A H R S P I T X M A B

Book Cipher• Running Key cipher.

Cipher

Block Cipher

Polygram Substitutio

n

Stream Cipher

Homophonic

Substitution

Transposition

• Permutation of position of

Plaintext alphabet.

• Rail Fence Technique

• Simple Columnar Transposition

• Simple Columnar Transposition

with Multiple Round

Cryptography

Encryption

Decryption

CryptographyCreate secret Code

• Encryption

o CT = Ek (PT)

• Decryption

o PT=Dk (CT) = Dk (Ek (PT))

Cryptography

• Input to the process o Algorithm

o Key

Cryptography

Symmetric Key

Asymmetric Key

Symmetric Key

• Same key is used for encryption

and decryption of message.

• Key Exchange Problem

Diffie-Hellman Algorithm

1. Pick random, secret x

2. Compute A = gx mod n

3. Send A to Bob

4. K1 = Bx Mod n

1. Pick random, secret y

2. Compute B = gy mod n

3. Send B to Alice

4. K2 = Ay Mod n

Alice and Bob agree on two

prime number n and g

Diffie – Hellman

K1 = (gx mod n)y = gxy mod n

K2 = (gy mod n)x = gxy mod n

• Let n = 11 and g = 7

• Let x = 3 and compute A

• Let y = 6 and compute B

• Calculate K1 and K2

Solution

1. N = 11 , g = 7

2. x = 3 then A = 73 Mod 11 = 2

3. y = 6 then B = 76 Mod 11 = 4

4. K1 = 43 Mod 11 = 9

5. K2 = 26 Mod 11 = 9

Problem with Algorithm

• Man in Middle attack

Asymmetric Key

top related