Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

LEC 3

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 45

Lecture 3

Data Security :
Classical encryption

Dr. Khaled Saada


Definitions
Data Security
Data is any type of stored digital information.
The security of data means the protection of data.
CD drive

10110011101 Digital-to-analog Linear amplifier


Digital data converter Analog
reproduction
of music audio Speaker
signal
Sound
waves

Digital Data
Voice ,image, video, and computer
3 data
Definitions
Data Security
 Data is any type of stored digital information.
 The security of data means the protection of data.

4
Cryptogr
What is
aphy
Cryptography ?
word Cryptography comes from the Greek words
Hidden or secret
 writing

Cryptography is the art of Secret


writing
The basic service of cryptography is the
ability to send information between
participants in a way that prevents others
from reading
5
Communication is the transfer of information from one point to
another

No Data
security

Sender

Hello Bob

Receiver

Data security: private communication in a public


world
6
Data
Security
The sender puts the message in a box
and locks the box by using a key; the
receiver unlocks the box with a key and
takes out the message

sender receiver

7
Definitio
ns
Encipher (encrypt) : converting plain text to
cipher text
Decipher( decrypt): recovering cipher text from
plain text
Cryptography : study of encryption principles /
methods
Cryptanalysis (code breaking) : the study of
principles / methods of deciphering cipher text
with out knowing
plaintext key message
: the original
Cryptology
cipher text : :the
thecoded
field message
of both cryptography and
cryptanalysis.
Key : information used in cipher known only to
sender / receiver.
EnCipher : algorithm for transforming plain text
to cipher text.

8
Symmetric Cipher Model

1
Classical Method
Substitution Cipher replacement blades
In this type of cipher, encryption would be through the
establishment of a character from the original text
(Plaintext) with another character to be the cipher char,
this substitution would be achieved by collecting the
key to the character of the original text.
 Transposition replacement blades
In this type, the encryption is achieved by the
relocation letters of the original text
Some books call this type name (Permutation)
 XOR
There are some books that classify this way through
encryption with classical methods, and in spite of the
weakness of these Way, but most modern ciphers rely
on this process in mathematical operation and other
processes
2
Substitution Cipher

 Monoalphabetic Substitution Cipher


( Affine, Caesar, ROT13 , Atbash Cipher ,
Additive
, Multiplicative )Cipher

 Polyalphabetic Substitution Cipher


(simple vigenere , full
vigenere )
 PolyGram Substitution Cipher
(play fair , Hill ) Cipher
 Homophonic Substitution Cipher

3
Substitution ciphers Additive Cipher
Mono-alphabetic

o The simplest monoalphabetic cipher is the additive


cipher. This cipher is sometimes called a shift cipher
and sometimes a Caesar cipher, but the term additive
cipher better reveals its mathematical nature

P1 = (C—k) mod 26 = (P + k — k) mod 26 = P


4
Substitution ciphers Caesar
Mono-alphabetic
cipher
Caesar cipher is also called shift cipher
It’s a type of substitution cipher in which each letter
in the plaintext is replaced by a letter some fixed
number positions down the alphabet

5
ryptography example:

Plain text : Data security


Cipher text:

Plain text : Ministry of Higher Education


Cipher text:
6
The algorithm can be expressed as follows. For each
plaintext letter p, substitute the cipher text letter C

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

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


Caesar algorithm is
C = E(k, p) = (p + k) mod 26

where k takes on a value in the range 1 to 25.


The decryption algorithm is simply

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

7
Encrypt the message "THIS IS AN EXERCISE"
using a shift cipher with a key of 20. Ignore
the space between words. Decrypt the
message to get the original plaintext.

8
The encrypted message is NBCM CM UH
YRYLWCMY.

9
Substitution
Multiplicative Ciphers
ciphers
Mono-alphabetic

In a multiplicative cipher, the plaintext


and cipher text are integers in Z26 the
key Is an integer in Z26.
10
Substitution
Affine
ciphers
Mono-alphabetic
cipher

11
Affine
cipher
Algorithm
k = (a , b) is the encryption key
Encryption algorithm Ek(x) = a x + b mod (256 or 26)
Decryption algorithm Dk(y) = a -1 (y - b) mod (256 or 26)
note: (a -1) mod (256 or 26) exists iff gcd (a, 26 or 256) = 1

Cryptanalysis
1. Brute force attack
In case of ASCII plaintext: total number of keys = ((256)  256)
= (2 8 - 2 7)  2 8 = 2 15 = 3.27  10 4
If Affine cipher is poly-alphabetic cipher having m characters
block length then the total number of available keys =
((256)  256)m = (3.27  10 4 )m
2. Statistics of ciphertext
A rearranged version of plaintext statistics
12
Substitution
ROT 13
ciphers
Mono-alphabetic
o ROT13 ("rotate by 13 places", sometimes hyphenated ROT-13 ) is a
simple letter substitution cipher that replaces a letter with the letter
13 letters after it in the alphabet.
o ROT13 is an example of the Caesar cipher, developed in ancient
Rome.
o In the basic Latin alphabet, ROT13 is its own inverse; that is, to undo
ROT13, the same algorithm is applied, so the same action can be
used for encoding and decoding. The algorithm provides virtually no
cryptographic security, and is often cited as a canonical example of
weak encryption.

13
Enigma Rotor Machine

14
Substitution
Atbash
ciphers
Mono-alphabetic

o Atbash is a simple substitution cipher for the


Hebrew alphabet.
o It consists in substituting aleph (the first letter)
for tav (the last), beth (the second) for shin (one
before last), and so on, reversing the alphabet.
o An Atbash cipher for the Latin alphabet would be
as follows:
o Plain: abcdefghijklmnopqrstuvwxyz
o Cipher: ZYXWVUTSRQPONMLKJIHGFEDCBA

15
Atbas
h
o An easier, simpler and faster way of doing this is:
o First 13 letters: A|B|C|D|E|F|G|H|I|J|K|L|M
o Last 13 Letters: Z|Y|X|W|V|U|T|S|R|Q|P|O|N
o Atbash can also be used to mean the same thing in
any other alphabet as well.
o This is a very simple substitution cipher.
o For example, in Atbash, the letters "nlmvb" indicate
the word "money" Worked Example.
o It is a very weak cipher because it only has one
possible key, and it is a simple monoalphabetic
substitution cipher.
16
Poly alphabetic
Ciphers
Poly-alphabetic
substitution:

1. a = p , b = y ,c
= k.
2. a = b , b = g ,c
= f.
3. a = w , b = e ,c
= s.

17
Poly alphabetic CiphersVigenere cipher

Use different monoalphabetic substitutions as one proceeds


through the plaintext message.
1. A set of related monoalphabetic substitution rules i.e.,
table is used.
2. A key determines which particular rule is chosen for a
given transformation.

18
Vigenere Cipher (Modern Table)

19
Vigenere Cipher

• The set of related mono-alphabetic substitution rules consists of 26


Caeser ciphers, with shifts of 0 through 25. Each cipher is denoted
by a key letter. Caeser with shift 3 has the key k= d
• Multiple ciphertext letters for each plaintext letter, one for each
unique letter of the key word i.e. improvement over Playfair.
• Not all knowledge of the plaintext structure is lost

• If the key length word is N then the cipher is in effect consisting


of N mono-alphabetic substitutions
• The periodic nature of the key word can be eliminated using a non
repeating keyword that is as long as the message itself with no
statistical relation to the message
20
Vigenere Cipher
Let m be a fixed positive integer.
Encryption algorithm
Ek(x1, x2, …, xm) = (x1+k1, x2+k2 ,….., xm+km)
Decryption algorithm
Dk(y1, y2,…, y3) = (y1-k1, y2-k2,……., ym-km)

Cryptanalysis
1. Brute force attack

Key length m m=6


No. of English alphabetic keys 26m 266 = 3  109
No. of ASCII code keys 256m 2566 = 2.8  1014
2. Cipher-text statistics
hides statistics of patterns up to m characaters
21
PolyGram Playfair Cipher
Ciphers
English alphabetic is filled in 5  5 matrix (I/J)
considered as one character, start filling the matrix
using key characters, the rest spaces of matrix is
filled using other alphabetic characters. Encryption
algorithm is simply: each plaintext character is
replaced by the letter that lies in its own row and the
column occupied by the other plaintext character

22
Playfair Cipher

1. This is the most common digraphic system. It is


always capitalized because it was named for Lord
Mayfair of England.

2. English alphabetic is filled in 5  5 matrix with (I/J)


considered as one character. Start filling the matrix
using key characters. The rest spaces of the matrix is
filled using other alphabetic characters.

3. Encryption algorithm is simply: each plaintext


character is replaced by the letter that lies in its own
row and the column occupied by the other plaintext
character

23 Cryptanalysis: Use Brute force attack


If the key is “MONARCHY” then the matrix will be
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
1. Repeated plaintext characters that would fall in the same pair
are
separated with a filler character, such as “X”, so the “BALLOON”
would be encrypted as “BA LX LO ON”.
2. Plaintext characters that fall in the same row of the matrix are
each
replaced by the letter to the right, with the first element of the
row
circularly following the last. For example, “AR” is encrypted as
“RM”
3. Plaintext characters that fall in the same column are each
replaced
24 by the character beneath, with the top element of the row
Playfair Example

If the key is “MONARCHY” then the matrix will


be
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

1. Repeated plaintext characters that would fall in the same pair


are separated with a filler character, such as “X”, so the
“BALLOON” would be encrypted as “BA LX LO ON”.

2. Plaintext characters that fall in the same row of the matrix are
each replaced by letter to the right, with the first element of the
row circularly following the last. For example, “AR” is encrypted
25 as “RM”.
M O N A R M O N A R

C H Y B D C H Y B D

E F G I/J K E F G I/J K

L P Q S T L P Q S T

U V W X Z U V W X Z

3.Plaintext characters that fall in the same column are each


replaced by the character beneath, with the top element of
the row circularly following the last. For example, “MU”
encrypted as “CM”.

4.Otherwise, each plaintext character is replaced by the letter


that lies in its own row and the column occupied by the other
plaintext character. Thus “HS” becomes “BP”, and “EA”
becomes “IM” or “JM”.
26
PolyGram Ciphers Hill Cipher

.Each letter is first encoded as a number

Consider the message 'ACT', and the key


:(GYBNQKURP)
:Key :Message

:Thus the enciphered vector is given by

‘Which corresponds to a Cipher text of 'POH

:Thus the plain text vector is given by

27
Hill cipher
Another interesting multiletter cipher is the Hill cipher. It is
developed by Lester Hill in 1929. The encryption algorithm takes m
plaintext letters and substitutes for them m ciphertext letters. The
substitution is determined by m linear equations in which each
character is assigned a numerical value (a=0 , b=1….………z =25).
For m=3 the cipher gives

C = K P, K is the key
28
Hill cipher Analysis (ctd)

•Completely hides the single letter frequency


•Use of larger matrix hides more frequency information
•Although the hill cipher is strong against ciphertext-
only-attack it is very easily broken with a known
plaintext attack

29
Transposition Cipher

A transposition cipher reorders


(permutes) symbols in a block of
symbols.

30
Transposition Cipher Rail Fance

A transposition cipher reorders


(permutes) symbols in a block of
symbols.
The plaintext is written down as a sequence of
diagonals and then read off as a sequence of rows. For
example, to encipher the message "meet me after the
toga party" with a rail fence of depth 2, we write the
following:

The encrypted message is


31
MEMATRHTGPRYETEFETEOAAT
Row Trasposition

This sort of thing would be trivial to cryptanalyze. A


more complex scheme is to write the message in a
rectangle, row by row, and read the message off,
column by column, but permute the order of the
columns. The order of the columns then becomes the
key to the algorithm. For example,

32
A pure transposition cipher is easily recognized
because it has the same letter frequencies as the
original plaintext. The transposition cipher can be
made significantly more secure by performing more
than one stage of transposition.
Cipher text
Key :
Input:

Cutput: ATTACKPOST PONEDUNTILT WOAMXYZ

33
Exampl
e

34
( XOR
Vernam
cipher ) Cipher

Plaintext :

Cipher text

35
Combination Substitution/Transposition Cipher

One Time Pad (Vernam Cipher)

36
OTP Rules

• The OTP should consist of truely random numbers

• Precisely two copies of the OTP should exist.

• The OTP should only be used once.

• Both copies of the OTP are destroyed immediately


after use.

37
OTP Example (Modulo26)
• Here, we combine the key and the message using
modular addition.

• The numerical values of corresponding message


and key letters are added together, modulo 26.

• If key material begins with "XMCKL" and the


message is "HELLO", then the coding would be……..

38

You might also like