You are on page 1of 29

# Cryptography

Cryptography
`

Cryptography is the art of achieving security by encoding messages to make them non readable. Plain Text Cipher Text Encryption Decryption Key cryptography - study of encryption principles/methods cryptanalysis (code breaking) - the study of principles/ methods of deciphering cipher text without knowing key cryptology - the field of both cryptography and cryptanalysis

` ` ` ` ` ` `

Hello John

Hello John

Encrypt

Decrypt

Ifmmp Kpio

Internet

Ifmmp Kpio

Cryptographic Techniques
Substitution Techniques. -- Caesar Cipher -- Modified version of Caesar Cipher -- Mono-alphabetic Cipher -- Homophonic Cipher -- Polygram Cipher -- Polyalphabetic Cipher

## Shift cipher (ceasar cipher)

5

with a shift of 3

monoalphabetic cipher
6

Homophonic Cipher

Polygram Cipher

Polyalphabetic cipher
Vigenre Tableau
9

10

## key: deceptivedeceptivedeceptive plaintext: wearediscoveredsaveyourself ciphertext: ZICVTWQNGRZGVTWAVZHCQYGLMGJ

Transposition Techniques. -- Rail Fence Technique -- Single Columnar Transposition Technique --Single Columnar Transposition Technique with multiple rounds -- Vernam Cipher(One time pad) -- Book Cipher

## Rail Fence Cipher

M e m a t r h t g p r y e t e f e t e o a a t MEMATRHTGPRYETEFETEOAAT Write message on alternate rows, and read off cipher row by row

## Columnar Transposition Technique

Vernam Cipher

Translate each plain text alphabet in to corresponding Number(i.e. A=0, B=1,,Z=25) Do same for each character input cipher text Add plain text and one time pad If the sum thus produced is greater than 26,subtract 26 from it.

Cryptographic Mechanisms
Symmetric Key Cryptography Asymmetric Key Cryptography

## Diffie-Hellman Key Exchange Algorithm P

Prime number n
Exchange n and g

Q
Prime number g

Random number y Random number x Calculate B as:Calculate A as :B=gy mod n A=gx mod n Exchange
A and B

## Computes the key K2 as:K2=Ay mod n

K1=K2

For Example P
n=11 x=3 Calculate A as :A=73 mod 11 =343 mod 11 =2 Computes the key K1 as:K1=43 =9 mod 11 = 64 mod 11
Exchange A and B Exchange n and g

Q
g=7 y=6 Calculate B as:B=76 mod 11 =117649 mod 11 =4

K1=K2

Alice

n=11,g=7

x=3

Tom

n=11,g=7

x=8,y=6

Bob

n=11,g=7

y=9

Continued..

Alice

Tom

Bob

79 mod 11=8

B=4

Intercept

Continued..

Alice

## A=2 , B=4 K1=43 mod 11=9

Tom

A=2, B=8 K1=88 mod 11=5 K2=26 mod 11=9 A=9 , B=8 K2=99 mod 11=5

Bob

## MITM attack is also known as:

attack Fire brigade attack Monkey-in-the-middle attack Session hijacking TCP hijacking TCP session hijacking

## Asymmetric Key Cryptography

RSA Algorithm
Choose two large prime numbers P and Q Calculate N=PxQ Select Public key E as not a factor of (P-1)x(Q-1) Select Private key D as (DxE) mod (P-1)x(Q-1)=1 For Encryption, CT=PTE mod N Send CT to the receiver For Decryption, PT=CTD mod N

Digital Signature

Message Digest

MD5
Steps: 1.) Padding 2.) Append Length 3.) Divide the input into 512-bit blocks 4.) Initialize chaining variables 5.) Process Blocks 5.1> copying chaining variables 5.2> Divide current 512 block into sub-blocks 5.3> perform 4 rounds

End of Chapter