Top Banner
Classical Encryption Techniques 1 Classical Encryption Techniques 1
72

Computer Security Lecture 2: Classical Encryption Techniques 1

Mar 22, 2017

Download

Education

Mohamed Loey
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Computer Security Lecture 2: Classical Encryption Techniques 1

Classical Encryption Techniques 1

Classical Encryption Techniques 1

Page 2: Computer Security Lecture 2: Classical Encryption Techniques 1

Classical Encryption Techniques 1

Symmetric Encryption

Substitution Techniques

Caesar Cipher

Monoalphabetic Cipher

Playfair Cipher

Hill Cipher

Page 3: Computer Security Lecture 2: Classical Encryption Techniques 1

Classical Encryption Techniques 1

Symmetric Encryption

Substitution Techniques

Caesar Cipher

Monoalphabetic Cipher

Playfair Cipher

Hill Cipher

Page 4: Computer Security Lecture 2: Classical Encryption Techniques 1

Classical Encryption Techniques 1

Page 5: Computer Security Lecture 2: Classical Encryption Techniques 1

Classical Encryption Techniques 1

Encryption algorithm: The encryption algorithm performs various

substitutions and transformations on the plaintext.

Secret key: The secret key is also input to the encryption algorithm.

The key is a value independent of the plaintext and of the algorithm.

The algorithm will produce a different output depending on the

specific key being used at the time.

Page 6: Computer Security Lecture 2: Classical Encryption Techniques 1

Classical Encryption Techniques 1

Ciphertext: This is the scrambled message produced as output. It

depends on the plaintext and the secret key.

Decryption algorithm: This is essentially the encryption algorithm run

in reverse. It takes the ciphertext and the secret key and produces

the original plaintext.

Page 7: Computer Security Lecture 2: Classical Encryption Techniques 1

Classical Encryption Techniques 1

Symmetric-key algorithms are algorithms for cryptography that use

the same cryptographic keys for both encryption of plaintext and

decryption of ciphertext.

Page 8: Computer Security Lecture 2: Classical Encryption Techniques 1

Classical Encryption Techniques 1

Symmetric Encryption

Substitution Techniques

Caesar Cipher

Monoalphabetic Cipher

Playfair Cipher

Hill Cipher

Page 9: Computer Security Lecture 2: Classical Encryption Techniques 1

Classical Encryption Techniques 1

Cipherered text

3IODQN HDVW

DWWDFN DW GDZQ

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 B C

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

The clear text message would be

encoded using a key of 3.

1FLANK EAST

ATTACK AT DAWN

Shift the top

scroll over by

three characters

(key of 3), an A

becomes D, B

becomes E, and

so on.

2

The clear text message would

be encrypted as follows using a

key of 3.

Clear text

Page 10: Computer Security Lecture 2: Classical Encryption Techniques 1

Classical Encryption Techniques 1

Caesar Cipher

Monoalphabetic Ciphers

Playfair Cipher

Hill Cipher

Polyalphabetic Ciphers

Vigenère Cipher

Autokey Cipher

Vernam Cipher

Page 11: Computer Security Lecture 2: Classical Encryption Techniques 1

Classical Encryption Techniques 1

Symmetric Encryption

Substitution Techniques

Caesar Cipher

Monoalphabetic Cipher

Playfair Cipher

Hill Cipher

Page 12: Computer Security Lecture 2: Classical Encryption Techniques 1

Classical Encryption Techniques 1

Caesar Cipher is one of the simplest and most

widely known encryption techniques.

Page 13: Computer Security Lecture 2: Classical Encryption Techniques 1

Classical Encryption Techniques 1

Page 14: Computer Security Lecture 2: Classical Encryption Techniques 1

Classical Encryption Techniques 1

Page 15: Computer Security Lecture 2: Classical Encryption Techniques 1

Classical Encryption Techniques 1

Page 16: Computer Security Lecture 2: Classical Encryption Techniques 1

Classical Encryption Techniques 1

PlainText = dcodex

K=3

1) P=d

2) P=3

3) C=P+K mod 26=3+3 mod 26=6 mod 26 =6

4) C=g

Page 17: Computer Security Lecture 2: Classical Encryption Techniques 1

Classical Encryption Techniques 1

PlainText = dcodex

K=3

1) P=x

2) P=23

3) C=P+K mod 26=23+3 mod 26=26 mod 26= 0

4) C=a

Page 18: Computer Security Lecture 2: Classical Encryption Techniques 1

Classical Encryption Techniques 1

P= dcodex

C= gfrgha

K=3

Page 19: Computer Security Lecture 2: Classical Encryption Techniques 1

Classical Encryption Techniques 1

CipherText = gfrgha

K=3

1) C=g

2) C=6

3) P=C-K mod 26=6-3 mod 26=3

4) P=d

Page 20: Computer Security Lecture 2: Classical Encryption Techniques 1

Classical Encryption Techniques 1

CipherText = gfrgha

K=3

1) C=a

2) C=0

3) P=C-K mod 26=0-3 mod 26=-3 mod 26 =23

4) P=x

Page 21: Computer Security Lecture 2: Classical Encryption Techniques 1

Classical Encryption Techniques 1

C= gfrgha

P= dcodex

K=3

Page 22: Computer Security Lecture 2: Classical Encryption Techniques 1

Classical Encryption Techniques 1

Three important characteristics of this problem enabled us to use a

bruteforce cryptanalysis:

The encryption and decryption algorithms are known.

There are only 25 keys to try.

The language of the plaintext is known and easily

recognizable.

Page 23: Computer Security Lecture 2: Classical Encryption Techniques 1

Classical Encryption Techniques 1

Page 24: Computer Security Lecture 2: Classical Encryption Techniques 1

Classical Encryption Techniques 1

How to implement Caesar Cipher

technique on Arabic letters?

Page 25: Computer Security Lecture 2: Classical Encryption Techniques 1

Classical Encryption Techniques 1

Symmetric Encryption

Substitution Techniques

Caesar Cipher

Monoalphabetic Cipher

Playfair Cipher

Hill Cipher

Page 26: Computer Security Lecture 2: Classical Encryption Techniques 1

Classical Encryption Techniques 1

A monoalphabetic cipher uses fixed substitution over

the entire message

Random Key

Page 27: Computer Security Lecture 2: Classical Encryption Techniques 1

Classical Encryption Techniques 1

Example:

Plaintext alphabets: ABCDEFGHIJKLMNOPQRSTUVWXYZ

Ciphertext alphabet: ZEBRASCDFGHIJKLMNOPQTUVWXY

P= ITEMS

Encoding

C= FQAIP

Decoding

P= ITEMS

Page 28: Computer Security Lecture 2: Classical Encryption Techniques 1

Classical Encryption Techniques 1

Relative Frequency of

Letters in English Text

Page 29: Computer Security Lecture 2: Classical Encryption Techniques 1

Classical Encryption Techniques 1

C=

Page 30: Computer Security Lecture 2: Classical Encryption Techniques 1

Classical Encryption Techniques 1

cipher letters P and Z are the equivalents of plain letters e and t

Page 31: Computer Security Lecture 2: Classical Encryption Techniques 1

Classical Encryption Techniques 1

Finally, The complete plaintext

Page 32: Computer Security Lecture 2: Classical Encryption Techniques 1

Classical Encryption Techniques 1

How to implement Monoalphabetic

Cipher technique on Arabic letters?

Page 33: Computer Security Lecture 2: Classical Encryption Techniques 1

Classical Encryption Techniques 1

Symmetric Encryption

Substitution Techniques

Caesar Cipher

Monoalphabetic Cipher

Playfair Cipher

Hill Cipher

Page 34: Computer Security Lecture 2: Classical Encryption Techniques 1

Classical Encryption Techniques 1

The Playfair system was invented by Charles Wheatstone, who first

described it in 1854.

Used by many countries during wartime

The Playfair algorithm is based on the use of a 5 x 5 matrix of

letters constructed using a keyword.

Page 35: Computer Security Lecture 2: Classical Encryption Techniques 1

Classical Encryption Techniques 1

In this case, the keyword is monarchy.

Page 36: Computer Security Lecture 2: Classical Encryption Techniques 1

Classical Encryption Techniques 1

4 Rules:

1) If both letters are the same (or only one letter is left),

add an "X" after the first letter.

2) If the letters appear on the same row of your table,

replace them with the letters to their immediate right

respectively

Page 37: Computer Security Lecture 2: Classical Encryption Techniques 1

Classical Encryption Techniques 1

4 Rules:

3) If the letters appear on the same column of your table,

replace them with the letters immediately below

respectively

4) If the letters are not on the same row or column, replace

them with the letters on the same row respectively but at

the other pair of corners of the rectangle defined by the

original pair.

Page 38: Computer Security Lecture 2: Classical Encryption Techniques 1

Classical Encryption Techniques 1

P=Hide the gold in the tree stump (note the null "X" used to separate

the repeated "E"s)

P= HI DE TH EG OL DI NT HE TR EX ES TU MP

K= playfair example

Page 39: Computer Security Lecture 2: Classical Encryption Techniques 1

Classical Encryption Techniques 1

How to build 5x5 Matrix (assuming that I and J are

interchangeable), the table becomes (omitted letters in red):

Page 40: Computer Security Lecture 2: Classical Encryption Techniques 1

Classical Encryption Techniques 1

P= HI DE TH EG OL DI NT HE TR EX ES TU MP

Page 41: Computer Security Lecture 2: Classical Encryption Techniques 1

Classical Encryption Techniques 1

P= HI DE TH EG OL DI NT HE TR EX ES TU MP

Page 42: Computer Security Lecture 2: Classical Encryption Techniques 1

Classical Encryption Techniques 1

P= HI DE TH EG OL DI NT HE TR EX ES TU MP

Page 43: Computer Security Lecture 2: Classical Encryption Techniques 1

Classical Encryption Techniques 1

P= HI DE TH EG OL DI NT HE TR EX ES TU MP

Page 44: Computer Security Lecture 2: Classical Encryption Techniques 1

Classical Encryption Techniques 1

P= HI DE TH EG OL DI NT HE TR EX ES TU MP

Page 45: Computer Security Lecture 2: Classical Encryption Techniques 1

Classical Encryption Techniques 1

C= BM OD ZB XD NA BE KU DM UI XM MO UV IF

the message "Hide the gold in the tree stump" becomes

"BMODZ BXDNA BEKUD MUIXM MOUVI F"

Page 46: Computer Security Lecture 2: Classical Encryption Techniques 1

Classical Encryption Techniques 1

Using Playfair Cipher how to decrepit the

following cipher text:

C= “BMODZ BXDNA BEKUD MUIXM MOUVI F”

K= playfair example

Page 47: Computer Security Lecture 2: Classical Encryption Techniques 1

Classical Encryption Techniques 1

Symmetric Encryption

Substitution Techniques

Caesar Cipher

Monoalphabetic Cipher

Playfair Cipher

Hill Cipher

Page 48: Computer Security Lecture 2: Classical Encryption Techniques 1

Classical Encryption Techniques 1

The Hill Cipher was invented by Lester S. Hill in 1929

The Hill Cipher based on linear algebra

Encryption

2 x 2 Matrix Encryption

3 x 3 Matrix Encryption

Page 49: Computer Security Lecture 2: Classical Encryption Techniques 1

Classical Encryption Techniques 1

square matrix 𝑀 by the equation 𝑀𝑀−1= 𝑀−1𝑀= 𝐼, where 𝐼 is the

identity matrix.

C = P*K mod 26

Page 50: Computer Security Lecture 2: Classical Encryption Techniques 1

Classical Encryption Techniques 1

Page 51: Computer Security Lecture 2: Classical Encryption Techniques 1

Classical Encryption Techniques 1

Example of Key 2 x 2

𝐾 =𝐻 𝐼𝐿 𝐿

=7 811 11

plaintext message "short example“

𝑃= short example

𝑃 =𝑆ℎ

𝑜𝑟

𝑡𝑒

𝑥𝑎

𝑚𝑝

𝑙𝑒

=187

1417

194

230

1215

114

Page 52: Computer Security Lecture 2: Classical Encryption Techniques 1

Classical Encryption Techniques 1

𝑃 =𝑆ℎ

𝑜𝑟

𝑡𝑒

𝑥𝑎

𝑚𝑝

𝑙𝑒

=187

1417

194

230

1215

114

𝐶 = 𝐾 ∗ 𝑃 𝑚𝑜𝑑 26

𝑘0 𝑘1𝑘2 𝑘3

∗𝑝0𝑝1

=𝑘0 ∗ 𝑝0 + 𝑘1 ∗ 𝑝1𝑘2 ∗ 𝑝0 + 𝑘3 ∗ 𝑝1

7 811 11

∗187

=7 ∗ 18 + 8 ∗ 711 ∗ 18 + 11 ∗ 7

=182275

𝐶 =182275

𝑚𝑜𝑑 26 =015

=𝑎𝑝

Page 53: Computer Security Lecture 2: Classical Encryption Techniques 1

Classical Encryption Techniques 1

𝑃 =𝑆ℎ

𝑜𝑟

𝑡𝑒

𝑥𝑎

𝑚𝑝

𝑙𝑒

=187

1417

194

230

1215

114

Page 54: Computer Security Lecture 2: Classical Encryption Techniques 1

Classical Encryption Techniques 1

𝑃 =𝑆ℎ

𝑜𝑟

𝑡𝑒

𝑥𝑎

𝑚𝑝

𝑙𝑒

=187

1417

194

230

1215

114

Page 55: Computer Security Lecture 2: Classical Encryption Techniques 1

Classical Encryption Techniques 1

𝑃 =𝑆ℎ

𝑜𝑟

𝑡𝑒

𝑥𝑎

𝑚𝑝

𝑙𝑒

=187

1417

194

230

1215

114

Page 56: Computer Security Lecture 2: Classical Encryption Techniques 1

Classical Encryption Techniques 1

𝑃 =𝑆ℎ

𝑜𝑟

𝑡𝑒

𝑥𝑎

𝑚𝑝

𝑙𝑒

=187

1417

194

230

1215

114

Page 57: Computer Security Lecture 2: Classical Encryption Techniques 1

Classical Encryption Techniques 1

𝑃 =𝑆ℎ

𝑜𝑟

𝑡𝑒

𝑥𝑎

𝑚𝑝

𝑙𝑒

=187

1417

194

230

1215

114

Page 58: Computer Security Lecture 2: Classical Encryption Techniques 1

Classical Encryption Techniques 1

𝐶 =𝑎𝑝

𝑎𝑑

𝑗𝑡

𝑓𝑡

𝑤𝑙

𝑓𝑗

This gives us a final ciphertext of "APADJ TFTWLFJ"

Page 59: Computer Security Lecture 2: Classical Encryption Techniques 1

Classical Encryption Techniques 1

𝐶 =𝑎𝑝

𝑎𝑑

𝑗𝑡

𝑓𝑡

𝑤𝑙

𝑓𝑗

This gives us a final ciphertext of "APADJ TFTWLFJ“

𝐾 =𝐻 𝐼𝐿 𝐿

=7 811 11

We want to find 𝐾−1

Page 60: Computer Security Lecture 2: Classical Encryption Techniques 1

Classical Encryption Techniques 1

𝑆𝑡𝑒𝑝 1 − 𝐹𝑖𝑛𝑑 𝑡ℎ𝑒 𝑀𝑢𝑙𝑡𝑖𝑝𝑙𝑖𝑐𝑎𝑡𝑖𝑣𝑒 𝐼𝑛𝑣𝑒𝑟𝑠𝑒 𝑜𝑓 𝑡ℎ𝑒 𝐷𝑒𝑡𝑒𝑟𝑚𝑖𝑛𝑎𝑛𝑡

𝐷 𝐾 = 7 ∗ 11 − 8 ∗ 11 = −11 𝑚𝑜𝑑 26 = 15

𝐷𝐷−1 = 1𝑚𝑜𝑑 26 = 15 ∗ 𝐷−1

15 ∗ 𝐷−1𝑚𝑜𝑑 26 = 1

Try and Test 1 𝑚𝑜𝑑 26 = 105

105 mod 26 =1

𝐷−1 = 7

Page 61: Computer Security Lecture 2: Classical Encryption Techniques 1

Classical Encryption Techniques 1

𝑆𝑡𝑒𝑝 2 − 𝐹𝑖𝑛𝑑 𝑡ℎ𝑒 𝐴𝑑𝑗𝑢𝑔𝑎𝑡𝑒 𝑀𝑎𝑡𝑟𝑖𝑥 𝑜𝑓 𝐾𝑒𝑦

𝑎𝑑𝑗𝑎 𝑏𝑐 𝑑

=𝑑 −𝑏−𝑐 𝑎

𝑎𝑑𝑗7 811 11

=11 −8−11 7

mod 26 =11 1815 7

Page 62: Computer Security Lecture 2: Classical Encryption Techniques 1

Classical Encryption Techniques 1

𝑆𝑡𝑒𝑝 3 𝑀𝑢𝑙𝑡𝑖𝑝𝑙𝑦 𝑡ℎ𝑒 𝑀𝑢𝑙𝑡𝑖𝑝𝑙𝑖𝑐𝑎𝑡𝑖𝑣𝑒 𝐼𝑛𝑣𝑒𝑟𝑠𝑒 𝑜𝑓 𝑡ℎ𝑒 𝐷𝑒𝑡𝑒𝑟𝑚𝑖𝑛𝑎𝑛𝑡

𝑏𝑦 𝑡ℎ𝑒 𝐴𝑑𝑗𝑢𝑔𝑎𝑡𝑒 𝑀𝑎𝑡𝑟𝑖𝑥

7 ∗11 1815 7

=77 126105 49

𝑚𝑜𝑑 26 =25 221 23

= 𝐾−1

Page 63: Computer Security Lecture 2: Classical Encryption Techniques 1

Classical Encryption Techniques 1

𝐶 =𝑎𝑝

𝑎𝑑

𝑗𝑡

𝑓𝑡

𝑤𝑙

𝑓𝑗

=015

03

919

519

2211

59

Page 64: Computer Security Lecture 2: Classical Encryption Techniques 1

Classical Encryption Techniques 1

𝐶 =𝑎𝑝

𝑎𝑑

𝑗𝑡

𝑓𝑡

𝑤𝑙

𝑓𝑗

=015

03

919

519

2211

59

Page 65: Computer Security Lecture 2: Classical Encryption Techniques 1

Classical Encryption Techniques 1

𝐶 =𝑎𝑝

𝑎𝑑

𝑗𝑡

𝑓𝑡

𝑤𝑙

𝑓𝑗

=015

03

919

519

2211

59

Page 66: Computer Security Lecture 2: Classical Encryption Techniques 1

Classical Encryption Techniques 1

𝐶 =𝑎𝑝

𝑎𝑑

𝑗𝑡

𝑓𝑡

𝑤𝑙

𝑓𝑗

=015

03

919

519

2211

59

Page 67: Computer Security Lecture 2: Classical Encryption Techniques 1

Classical Encryption Techniques 1

𝐶 =𝑎𝑝

𝑎𝑑

𝑗𝑡

𝑓𝑡

𝑤𝑙

𝑓𝑗

=015

03

919

519

2211

59

Page 68: Computer Security Lecture 2: Classical Encryption Techniques 1

Classical Encryption Techniques 1

𝐶 =𝑎𝑝

𝑎𝑑

𝑗𝑡

𝑓𝑡

𝑤𝑙

𝑓𝑗

=015

03

919

519

2211

59

Page 69: Computer Security Lecture 2: Classical Encryption Techniques 1

Classical Encryption Techniques 1

Using Hill Cipher how to implement 3x3 matrix

encryption ? The key for a hill cipher is a matrix

e.g. 𝒌 =2 4 59 2 13 17 7

and message= ATTACK AT DAWN

Page 70: Computer Security Lecture 2: Classical Encryption Techniques 1

Classical Encryption Techniques 1

Use MS Word

Send me mail to [email protected] with email subject “

Classical Encryption Techniques 1 “

Put your name on Arabic with department and section on word and

email body

Finally, press Send

Deadline Next Lecture

Page 71: Computer Security Lecture 2: Classical Encryption Techniques 1

Classical Encryption Techniques 1

facebook.com/mloey

[email protected]

twitter.com/mloey

linkedin.com/in/mloey

[email protected]

mloey.github.io

Page 72: Computer Security Lecture 2: Classical Encryption Techniques 1

Classical Encryption Techniques 1

www.YourCompany.com© 2020 Companyname PowerPoint Business Theme. All Rights Reserved.

THANKS FOR YOUR TIME