network securityvisbamu.in/upload/informationtherory-2.pdfhill cipher is a polygraphic substitution...

47
NETWORK SECURITY PRAVIN YANNAWAR Department of Computer Science and IT 1

Upload: others

Post on 22-May-2020

9 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: NETWORK SECURITYvisbamu.in/Upload/InformationTherory-2.pdfHill Cipher Is a polygraphic substitution cipher based on linear algebra Invented by Lester S Hill in 1929 and it was the

NETWORK SECURITY

PRAVIN YANNAWAR

Department of Computer Science and IT

1

Page 2: NETWORK SECURITYvisbamu.in/Upload/InformationTherory-2.pdfHill Cipher Is a polygraphic substitution cipher based on linear algebra Invented by Lester S Hill in 1929 and it was the

Symmetric Ciphers2

Important Terms

Plain Text

Original Text is called plain text

Cipher Text

Coded Text is called Cipher text

Enciphering or Encryption

The process of converting plain text to cipher text

Deciphering or Decryption

The process of converting cipher text to plain text

Page 3: NETWORK SECURITYvisbamu.in/Upload/InformationTherory-2.pdfHill Cipher Is a polygraphic substitution cipher based on linear algebra Invented by Lester S Hill in 1929 and it was the

3

Cryptography

Is the scheme used for encryption constitutes an area for study is called cryptography.

Cryptanalysis

Technique used for deciphering a message without anyknowledge of enciphering text is called cryptanalysis

“Breaking the Code”

Cryptology

Is the area of cryptography and cryptanalysis used together.

Page 4: NETWORK SECURITYvisbamu.in/Upload/InformationTherory-2.pdfHill Cipher Is a polygraphic substitution cipher based on linear algebra Invented by Lester S Hill in 1929 and it was the

Model4

Page 5: NETWORK SECURITYvisbamu.in/Upload/InformationTherory-2.pdfHill Cipher Is a polygraphic substitution cipher based on linear algebra Invented by Lester S Hill in 1929 and it was the

5

Terms

Plain Text

The original intelligible message or data that is fed to algorithm

Encryption Algorithm

Performs various substitution or transformation on the plain text

Page 6: NETWORK SECURITYvisbamu.in/Upload/InformationTherory-2.pdfHill Cipher Is a polygraphic substitution cipher based on linear algebra Invented by Lester S Hill in 1929 and it was the

6

Secret key

Input to encryption algorithm

Key value is independent of text & algorithm.

Algorithm will produce transformed/substitution output based on key.

Cipher text

Is the scrambled message produced as output.

Depend on plain text and secret key

Is apparently random stream of data and as it stands as unintelligent.

Page 7: NETWORK SECURITYvisbamu.in/Upload/InformationTherory-2.pdfHill Cipher Is a polygraphic substitution cipher based on linear algebra Invented by Lester S Hill in 1929 and it was the

7

Decryption Algorithm

Inverse of encryption algorithm

Takes cipher text and secret key for generation of plain text.

Page 8: NETWORK SECURITYvisbamu.in/Upload/InformationTherory-2.pdfHill Cipher Is a polygraphic substitution cipher based on linear algebra Invented by Lester S Hill in 1929 and it was the

`8

Example: Let ‘A’ be the source, produces a message in a plain text

X=[X1,X2,X3….XM], where M elements of X, are letter insome finite alphabets.

For Encryption a Key of the form K=[K1,K2,K3…..KJ] isgenerated.

With message X and encryption key K as input, theencryption algorithm forms the cipher text

Y=[Y1,Y2,Y3…YN]

We can write as

Y=E(K,X) Encryption & X=D(K,Y) Decryption

Page 9: NETWORK SECURITYvisbamu.in/Upload/InformationTherory-2.pdfHill Cipher Is a polygraphic substitution cipher based on linear algebra Invented by Lester S Hill in 1929 and it was the

9

Conventional Cryptosystem

Page 10: NETWORK SECURITYvisbamu.in/Upload/InformationTherory-2.pdfHill Cipher Is a polygraphic substitution cipher based on linear algebra Invented by Lester S Hill in 1929 and it was the

10

Cryptography

Characterized into

Type of operation used for transforming plain text to cipher text. Based on two principals

Substitution (Substitution of alphabets, bits)

Transposition (Rearrangement)

The number of keys used

The way in which the plain text is processed.

Page 11: NETWORK SECURITYvisbamu.in/Upload/InformationTherory-2.pdfHill Cipher Is a polygraphic substitution cipher based on linear algebra Invented by Lester S Hill in 1929 and it was the

11

Cryptanalysis

Objective

To attack on encryption system to recover the key in userather then simply to recover plain text of cipher text.

Two Approaches Cryptanalysis

This attack exploits the characteristics of algorithm toattempt to figure out a specific plain text or figure outthe key

Brute-Force Attack

The Attacker tries very possible on a piece of cipher textuntil an intelligible translation into plain text is obtained.

Page 12: NETWORK SECURITYvisbamu.in/Upload/InformationTherory-2.pdfHill Cipher Is a polygraphic substitution cipher based on linear algebra Invented by Lester S Hill in 1929 and it was the

12

Types of attack on Encrypted Message

Type of Attack Known to Cryptanalyst

Ciphertext only •Encryption algorithm

•Ciphertext

Known plaintext •Encryption algorithm

•Ciphertext

•One or more plaintext-ciphertext pairs formed with the secret key

Chosen plaintext •Encryption algorithm

•Ciphertext

•Plaintext message chosen by cryptanalyst, together with its

corresponding ciphertext generated with the secret key

Page 13: NETWORK SECURITYvisbamu.in/Upload/InformationTherory-2.pdfHill Cipher Is a polygraphic substitution cipher based on linear algebra Invented by Lester S Hill in 1929 and it was the

13

Chosen text •Encryption algorithm

•Ciphertext

•Plaintext message chosen by cryptanalyst, together with its

corresponding ciphertext generated with the secret key

•Purported ciphertext chosen by cryptanalyst, together with its

corresponding decrypted plaintext generated with the secret key

Chosen ciphertext •Encryption algorithm

•Ciphertext

•Purported ciphertext chosen by cryptanalyst, together with its

corresponding decrypted plaintext generated with the secret key

Page 14: NETWORK SECURITYvisbamu.in/Upload/InformationTherory-2.pdfHill Cipher Is a polygraphic substitution cipher based on linear algebra Invented by Lester S Hill in 1929 and it was the

14

Important

No encryption algorithm is unconditionally secure

User of encryption algorithm can strive for

Is algorithm meets one or both criteria

Cost of breaking the cipher exceeds the value of theencrypted information

Time required to break the cipher, exceeds the useful lifetimeof the information

An encryption scheme is said to be computationallysecure if either foregoing criteria are met.

Page 15: NETWORK SECURITYvisbamu.in/Upload/InformationTherory-2.pdfHill Cipher Is a polygraphic substitution cipher based on linear algebra Invented by Lester S Hill in 1929 and it was the

15

Average Time required for exhaustive key search

Key size

(bits)

Number of alternative

keys

Time required at 1

decryption/m s

Time required at

10 6decryption/m s

32 2 32 = 4.3 x 10 9 2 31m s = 35.8 minutes 2.15 milliseconds

56 2 56 = 7.2 x 1016 2 55m s = 1142 years 10.01 hours

128 2 128 = 3.4 x 1038 2 127m s = 5.4 x 10 24years 5.4 x 10 18years

168 2 168 = 3.7 x 1050 2 167m s = 5.9 x 10 36years 5.9 x 10 30years

26

characters

(permutation)

26! = 4 x 10 26 2 x 10 26ms = 6.4 x 10 12years 6.4 x 10 6 years

Page 16: NETWORK SECURITYvisbamu.in/Upload/InformationTherory-2.pdfHill Cipher Is a polygraphic substitution cipher based on linear algebra Invented by Lester S Hill in 1929 and it was the

Substitution Technique16

There are two basic building blocks of encryptiontechniques

Substitution

Transposition

Substitution encryption

Is the classical encryption technique

In this method the letters of plain text are replaced byother letters or by numbers of symbol.

If plaintext is viewed as a sequence of bits, thensubstitution involves replacing plaintext bit patternswith ciphertext bit patterns

Page 17: NETWORK SECURITYvisbamu.in/Upload/InformationTherory-2.pdfHill Cipher Is a polygraphic substitution cipher based on linear algebra Invented by Lester S Hill in 1929 and it was the

Cont..17

Caesar Cipher

Is a known use of substitution cipher

Is the most simplest

Introduced by Julius Ceasar (Dictator, Roman Empire)

Example

plain: meet me after the toga party

cipher: PHHW PH DIWHU WKH WRJD SDUWB

Note: alphabet is wrapped around, so that the letter following Z is A

Page 18: NETWORK SECURITYvisbamu.in/Upload/InformationTherory-2.pdfHill Cipher Is a polygraphic substitution cipher based on linear algebra Invented by Lester S Hill in 1929 and it was the

18

Substitutionplain: 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

cipher: 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

Let us assign number to each letter

a b c d e f g h i j k L m

0 1 2 3 4 5 6 7 8 9 10 11 12

n o p q r s t u v w x y z

13 14 15 16 17 18 19 20 21 22 23 24 25

Page 19: NETWORK SECURITYvisbamu.in/Upload/InformationTherory-2.pdfHill Cipher Is a polygraphic substitution cipher based on linear algebra Invented by Lester S Hill in 1929 and it was the

19

The Algorithm can be expressed as For each plain letter ‘p’ substitute ciphertext letter ‘C’

C=E ( 3 , p ) = (p+3) mod 26

A shift may be of any amount, so that the general ceaseralgorithm is

C=E ( k , p ) = (p+k) mod 26

Where ‘k’ takes on a value in a range 1 to 25.

The Decryption algorithm is simply

p=D(k,C) = (C – k ) mod 26

Page 20: NETWORK SECURITYvisbamu.in/Upload/InformationTherory-2.pdfHill Cipher Is a polygraphic substitution cipher based on linear algebra Invented by Lester S Hill in 1929 and it was the

20

Example of Ceaser Cipher Plain Text : hello how are u

Cipher text: khoor krz duh x

Important The encryption and decryption algorithms are known

There are only 25 keys to try

The language of the plain text is known and easily recognizable

Page 21: NETWORK SECURITYvisbamu.in/Upload/InformationTherory-2.pdfHill Cipher Is a polygraphic substitution cipher based on linear algebra Invented by Lester S Hill in 1929 and it was the

21

Monoalphabetic Ciphers The ciphers in this substitution section replace each

letter with another letter according to the cipheralphabet.

Ciphers in which the cipher alphabet remainsunchanged throughout the message are calledMonoalphabetic Substitution Ciphers

If we permit the cipher alphabet to be anyrearrangement of the plain alphabet, then we cangenerate an enormous number of distinct modes ofencryption.

Page 22: NETWORK SECURITYvisbamu.in/Upload/InformationTherory-2.pdfHill Cipher Is a polygraphic substitution cipher based on linear algebra Invented by Lester S Hill in 1929 and it was the

22

There are over 400,000,000,000,000,000,000,000,000 suchrearrangements, which gives rise to an equivalent number ofdistinct cipher alphabets.

Each cipher alphabet is known as a key.

If our message is intercepted by the enemy, who correctlyassumes that we have used a monoalphabetic substitutioncipher, they are still faced with the impossible challenge ofchecking all possible keys.

If an enemy agent could check one of these possible keysevery second, it would take roughly one billion times thelifetime of the universe to check all of them and find thecorrect one.

This simple brute force approach clearly will not work.

Page 23: NETWORK SECURITYvisbamu.in/Upload/InformationTherory-2.pdfHill Cipher Is a polygraphic substitution cipher based on linear algebra Invented by Lester S Hill in 1929 and it was the

23

Example Plain text : hello how are u

Cipher Text : vudds vst opu k

Important Cipher Alphabet sequence for all 26 alphabets can be

generated randomly.

Page 24: NETWORK SECURITYvisbamu.in/Upload/InformationTherory-2.pdfHill Cipher Is a polygraphic substitution cipher based on linear algebra Invented by Lester S Hill in 1929 and it was the

24

Playfair Cipher Best known as multiple-letter encryption cipher.

It is based on the use of 5x5 matrix of lettersconstructed using a ‘keyword’

The matrix is constructed by filling in the letters of thekeyword (minus duplicates) from left to right and fromtop to bottom, and then filling in the remainder of thematrix with the remaining letters in alphabetic order

Charles Wheatstone

Page 25: NETWORK SECURITYvisbamu.in/Upload/InformationTherory-2.pdfHill Cipher Is a polygraphic substitution cipher based on linear algebra Invented by Lester S Hill in 1929 and it was the

25

The letters I and J count as one letter.

Plaintext is encrypted two letters at a time, according tothe following rules

Example: keyword = ‘MONARCH’

M O N A R

C H Y B D

E F G I/J K

L P Q S T

U V W X Z

Page 26: NETWORK SECURITYvisbamu.in/Upload/InformationTherory-2.pdfHill Cipher Is a polygraphic substitution cipher based on linear algebra Invented by Lester S Hill in 1929 and it was the

26

Process Repeating plaintext letters that are in the same pair are

separated with a filler letter, such as x, so that balloon would be treated as ba lx lo on.

Two plaintext letters that fall in the same row of thematrix are each replaced by the letter to the right, withthe first element of the row circularly following the last. For example, ar is encrypted as RM.

Page 27: NETWORK SECURITYvisbamu.in/Upload/InformationTherory-2.pdfHill Cipher Is a polygraphic substitution cipher based on linear algebra Invented by Lester S Hill in 1929 and it was the

27

Two plaintext letters that fall in the same column areeach replaced by the letter beneath, with the topelement of the column circularly following the last. For example, mu is encrypted as CM.

Otherwise, each plaintext letter in a pair is replaced bythe letter that lies in its own row and the columnoccupied by the other plaintext letter. Thus, hs becomes BP and ea becomes IM (or JM, as the

encipherer wishes).

Page 28: NETWORK SECURITYvisbamu.in/Upload/InformationTherory-2.pdfHill Cipher Is a polygraphic substitution cipher based on linear algebra Invented by Lester S Hill in 1929 and it was the

28

Hill Cipher

Is a polygraphic substitution cipher based on linearalgebra

Invented by Lester S Hill in 1929 and it was the firstpolygraphic cipher in which it was practical to operatemore than three symbols at a time.

Working Each letter is assigned a digit in base 26:

A=0, B=1, C=2, D=3……Z=25

A block of ‘n’ letters is considered as a vector of ‘n’dimension, and multiplied by a ‘n x n’ matrix, modulo 26

Page 29: NETWORK SECURITYvisbamu.in/Upload/InformationTherory-2.pdfHill Cipher Is a polygraphic substitution cipher based on linear algebra Invented by Lester S Hill in 1929 and it was the

29

Component of the matrix are the key, and should be random provided that the matrix is invertible in (to ensure that encryption is possible)

Example

Consider the message ‘COE’

Key = ANOTHERBZ in letters

Then

Ciphertext = (Key x Plaintext) mod 26

C=KP mod 26

Page 30: NETWORK SECURITYvisbamu.in/Upload/InformationTherory-2.pdfHill Cipher Is a polygraphic substitution cipher based on linear algebra Invented by Lester S Hill in 1929 and it was the

30

Decryption

Turn cipher text to plain text

Multiply the inverse matrix of the key matrix with the cipher text

P =( K-1 x C ) mod 26

Example in Detail Plain text: paymoremoney

Key

Page 31: NETWORK SECURITYvisbamu.in/Upload/InformationTherory-2.pdfHill Cipher Is a polygraphic substitution cipher based on linear algebra Invented by Lester S Hill in 1929 and it was the

31

First three letters are represented by vector

After multiplication with key matrix

Cipher text for first three letters ‘pay’ is ‘lns’ and accordingly the paymoremoney is encoded in cipher text lnshdlewmtrw

p a y15 0 24

Cipher Text11 L13 N18 S

Page 32: NETWORK SECURITYvisbamu.in/Upload/InformationTherory-2.pdfHill Cipher Is a polygraphic substitution cipher based on linear algebra Invented by Lester S Hill in 1929 and it was the

32

Decipherment

requires using the inverse of the matrix K .

The inverse K 1 of a matrix K is defined by theequation KK 1 = K 1 K = I , where I is the matrix that is allzeros except for ones along the main diagonal fromupper left to lower right.

The inverse of a matrix does not always exist, but whenit does, it satisfies the preceding equation. In this case,the inverse is:

Page 33: NETWORK SECURITYvisbamu.in/Upload/InformationTherory-2.pdfHill Cipher Is a polygraphic substitution cipher based on linear algebra Invented by Lester S Hill in 1929 and it was the

33

Therefore

431x 494

570

Original Text

15 P

mod 26 0 A

24 Y

Page 34: NETWORK SECURITYvisbamu.in/Upload/InformationTherory-2.pdfHill Cipher Is a polygraphic substitution cipher based on linear algebra Invented by Lester S Hill in 1929 and it was the

34

Polyalphabetic Ciphers

Is the method to improve monoalphabetic cipher

The general name of this approach is Polyalphabeticsubstitution cipher.

Common feature A set of related monoalphabetic substitution rules is used.

A key determines which particular rule is chosen for a giventransformation.

Page 35: NETWORK SECURITYvisbamu.in/Upload/InformationTherory-2.pdfHill Cipher Is a polygraphic substitution cipher based on linear algebra Invented by Lester S Hill in 1929 and it was the

35

This cipher is given by Blaise De Vigenere, in sixteenth century, from the court of Henry III of France

To aid in understanding the scheme and to aid in its use, a matrix known as the Vigenre tableau is constructed

Page 36: NETWORK SECURITYvisbamu.in/Upload/InformationTherory-2.pdfHill Cipher Is a polygraphic substitution cipher based on linear algebra Invented by Lester S Hill in 1929 and it was the

36

Each of the 26 ciphers is laid out horizontally, with the key letter for each cipher to its left.

A normal alphabet for the plaintext runs across the top.The process of encryption is simple: Given a key letter x and a plaintext letter y,

the ciphertext letter is at the intersection of the row labeled xand the column labeled y; in this case the ciphertext is V.

Example key: deceptivedeceptivedeceptive

plaintext: wearediscoveredsaveyourself

ciphertext: ZICVTWQNGRZGVTWAVZHCQYGLMGJ

Page 37: NETWORK SECURITYvisbamu.in/Upload/InformationTherory-2.pdfHill Cipher Is a polygraphic substitution cipher based on linear algebra Invented by Lester S Hill in 1929 and it was the

37

Decipherment It is equally simple.

The key letter again identifies the row.

The position of the ciphertext letter in that row determinesthe column, and the plaintext letter is at the top of thatcolumn.

Example

Ciphertext: ZICVTWQNGRZGVTWAVZHCQYGLMGJ

Key : deceptivedeceptivedeceptive

Plaintext :wearediscoveredsaveyourself

Page 38: NETWORK SECURITYvisbamu.in/Upload/InformationTherory-2.pdfHill Cipher Is a polygraphic substitution cipher based on linear algebra Invented by Lester S Hill in 1929 and it was the

Transposition Technique38

Transposition ciphers encrypt plaintext by moving smallpieces of the massage around

They are rarely used

They differ form substitution ciphers in following way In transposition cipher the letter of plaintext are shifted

about to form cryptogram

This can be done in number of ways, and there are somesystem where whole words are transposed.

Page 39: NETWORK SECURITYvisbamu.in/Upload/InformationTherory-2.pdfHill Cipher Is a polygraphic substitution cipher based on linear algebra Invented by Lester S Hill in 1929 and it was the

39

Single Columnar Transposition It needs a keyword or phrase whole letters are numbered

according to the presence of alphabet.

Example: keyword heaven

The plain text is written in rows under the numbered keyword, one letter under each letter

Example : Plain text We are the best

h e a v e n4 2 1 6 3 5

Page 40: NETWORK SECURITYvisbamu.in/Upload/InformationTherory-2.pdfHill Cipher Is a polygraphic substitution cipher based on linear algebra Invented by Lester S Hill in 1929 and it was the

40

Rotor Machine Is an Example of Transposition Cipher

The Machine is consist of a set of independently rotatingcylinders through which an electrical pulses can flow

Each cylinder and 26 input and 26 output pins with internalwiring that connects each input pin to a unique output pin.

If we associate each input and output pin with a letter ofalphabet, then single cylinder defines monoalphabeticcipher.

Page 41: NETWORK SECURITYvisbamu.in/Upload/InformationTherory-2.pdfHill Cipher Is a polygraphic substitution cipher based on linear algebra Invented by Lester S Hill in 1929 and it was the

41

Page 42: NETWORK SECURITYvisbamu.in/Upload/InformationTherory-2.pdfHill Cipher Is a polygraphic substitution cipher based on linear algebra Invented by Lester S Hill in 1929 and it was the

42

Consider a machine with a single cylinder. After each input key isdepressed, the cylinder rotates one position, so that the internalconnections are shifted accordingly .

Thus, a different monoalphabetic substitution cipher is defined.

After 26 letters of plaintext, the cylinder would be back to theinitial position.

Thus, we have a polyalphabetic substitution algorithm with aperiod of 26

Page 43: NETWORK SECURITYvisbamu.in/Upload/InformationTherory-2.pdfHill Cipher Is a polygraphic substitution cipher based on linear algebra Invented by Lester S Hill in 1929 and it was the

43

Steganography A plaintext message may be hidden in one of two ways.

The methods of steganography conceal the existence ofthe message,

The methods of cryptography render the messageunintelligible to outsiders by various transformations ofthe text.

The word Steganography is a obsolete word revived byDavid Kahn

Page 44: NETWORK SECURITYvisbamu.in/Upload/InformationTherory-2.pdfHill Cipher Is a polygraphic substitution cipher based on linear algebra Invented by Lester S Hill in 1929 and it was the

44

Steganography is simple, but is the one that is time-consuming to construct,

It is one in which an arrangement of words or letterswithin an apparently safe text spells out the realmessage

There are various techniques have been used historically

Character Marking

Invisible Ink

Pin Punctures

Type writer correction ribbon

Page 45: NETWORK SECURITYvisbamu.in/Upload/InformationTherory-2.pdfHill Cipher Is a polygraphic substitution cipher based on linear algebra Invented by Lester S Hill in 1929 and it was the

45

Character Marking Selected letter of printed or typewritten text are overwritten

by pencil.

The Marks are ordinarily not visible unless the paper is held at an angle to bright line.

Invisible Ink A number of substances can be used for writing but leave no

visible trace until heat or some chemical is applied to thepaper.

Pin punctures: Small pin punctures on selected letters are ordinarily not

visible unless the paper is held up in front of a light

Page 46: NETWORK SECURITYvisbamu.in/Upload/InformationTherory-2.pdfHill Cipher Is a polygraphic substitution cipher based on linear algebra Invented by Lester S Hill in 1929 and it was the

46

Typewriter correction ribbon: Used between lines typed with a black ribbon, the results of

typing with the correction tape are visible only under astrong light

Page 47: NETWORK SECURITYvisbamu.in/Upload/InformationTherory-2.pdfHill Cipher Is a polygraphic substitution cipher based on linear algebra Invented by Lester S Hill in 1929 and it was the

47

Drawbacks of Steganography It requires a lot of overhead to hide a relatively few bits of

information.

Also, once the system is discovered , it becomes virtuallyworthless.

This problem, too, can be overcome if the insertion methoddepends on some sort of key.

Alternatively, a message can be first encrypted and thenhidden using steganography