0% found this document useful (0 votes)
3 views

2. classical techniqueS

The document discusses classical encryption techniques, focusing on symmetric ciphers, substitution methods, and transposition ciphers. It covers various algorithms such as the Caesar cipher, monoalphabetic and polyalphabetic ciphers, including the Vigenère cipher, as well as the One-Time Pad and Playfair cipher. Additionally, it touches on cryptanalysis methods and the importance of secure key management in encryption.

Uploaded by

N
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

2. classical techniqueS

The document discusses classical encryption techniques, focusing on symmetric ciphers, substitution methods, and transposition ciphers. It covers various algorithms such as the Caesar cipher, monoalphabetic and polyalphabetic ciphers, including the Vigenère cipher, as well as the One-Time Pad and Playfair cipher. Additionally, it touches on cryptanalysis methods and the importance of secure key management in encryption.

Uploaded by

N
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 43

Classical Encryption Techniques

1
Topic
• Symmetric cipher model
– Cryptography
– Cryptanalysis
• Substitution techniques
– Caesar cipher
– Monoalphabetic cipher
– Polyalphabetic cipher
– One time pad
– Playfair cipher
2
Symmetric Encryption
• Referred to as conventional / private-key /
single-key
• sender and recipient share a common key
• all classical encryption algorithms are private-
key
• most widely used

3
Some Basic Terminology
• plaintext - original message
• ciphertext - coded message
• cipher - algorithm for transforming plaintext to ciphertext
• key - info used in cipher known only to sender/receiver
• encipher (encrypt) - converting plaintext to ciphertext
• decipher (decrypt) - recovering plaintext from ciphertext

• cryptography - study of encryption principles/methods

• cryptanalysis (codebreaking) - study of principles/ methods


of deciphering ciphertext without knowing key

• cryptology - field of both cryptography and cryptanalysis


4
Symmetric Cipher Model

Simplified model of conventional encryption


5
Requirements
• two requirements for secure use of symmetric
encryption:
– a strong encryption algorithm
– a secret key known only to sender / receiver
• mathematically have:
Y = EK(X)
X = DK(Y)
• assume encryption algorithm is known
6
Cryptography
• characterize cryptographic system by:
– type of encryption operations used
• Two general principles:
– substitution / transposition
– Product system (multiple stages..)
– number of keys used
• single-key or private / two-key or public
– way in which plaintext is processed
• block / stream

7
Cryptanalysis
• Two general approaches to attacking a
conventional encryption scheme:

– Cryptanalysis or cryptanalytic attack


– brute-force attack

8
More Definitions
• Encryption scheme is unconditional secure
– Cipher text generated by the scheme does not contain
enough information to determine corresponding plaintext.
– the cipher text cannot be broken.
– no matter how much computer power or time is available.
• Encryption scheme is computational secure
– given limited computing resources so the cipher cannot be
broken

9
Brute Force Search
• always possible to simply try every key
• most basic attack, proportional to key size
Key Size Number of Time required at 1 Time required at
(bits) Alternative Keys decryption/µs 106 decryptions/µs
32 232 = 4.3 x 109 231 µs = 35.8 2.15 milliseconds
minutes
56 256 = 7.2 x 1016 255 µs = 1142 years 10.01 hours
128 2128 = 3.4 x 1038 2127 µs = 5.4 x 1024 5.4 x 1018 years
years
168 2168 = 3.7 x 1050 2167 µs = 5.9 x 1036 5.9 x 1030 years
years
26 26! = 4 x 1026 2 x 1026 µs = 6.4 x 106 years
characters 6.4 x 1012 years
(permutation
)

10
Classical Substitution Ciphers
• plaintext letters are replaced by other letters
or by numbers or symbols.

• if plaintext is viewed as a sequence of bits,


then substitution involves replacing plaintext
bit patterns with ciphertext bit patterns.

11
Caesar Cipher
• Also known substitution cipher
• first attested use in military.
• replaces each letter by 3rd letter further down
the alphabet
• example:
m e e t m e
P H H W P H

12
Caesar Cipher
• mathematically give each letter a number
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
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25

• We can define transformation as:


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

• then have Caesar cipher as:


c = E(p) = (p + k) mod (26)
p = D(c) = (c – k) mod (26)
13
Cryptanalysis of Caesar Cipher
• a brute force cryptanalysis easily decrypt.
• Encryption and decryption algorithms are
known.
• Try all the 25 possible keys

• The language of the plaintext is known and


easily recognizable.

14
Monoalphabetic Cipher
• Caesar cipher is one of the example of
monoalphabetic cipher.
• Monoalphabetic cipher is special substitution
technique.
• each plaintext letter maps to a different random
ciphertext letter
• So there are 26! Different cipher alphabets (4 x 1026 )
possible.
Plain: abcdefghijklmnopqrstuvwxyz
Cipher: DKVQFIBJWPESCXHTMYAUOLRGZN

Plaintext: ifwewishtoreplaceletters
Ciphertext: WIRFRWAJUHYFTSDVFSFUUFYA

15
Continued
Monoalphabetic Substitution Cipher

Because additive, multiplicative, and affine ciphers have small


key domains, they are very vulnerable to brute-force attack.
A better solution is to create a mapping between each plaintext
character and the corresponding ciphertext character. Alice and
Bob can agree on a table showing the mapping for each
character.
An example key for monoalphabetic substitution cipher

16
Continued

Example
We can use the given key to encrypt the message.

The ciphertext is

17
Monoalphabetic Cipher Security
• Caesar cipher is far from secure because only 25
possible keys.
• now have a total of 26! = 4 x 1026 keys
• with so many keys, might think is secure
• If the cryptanalyst knows the nature of the
plaintext(non compressed English text) then analyst
can exploit the data.
• Relative frequency of cipher text letters can be
determined and compare to a standard frequency
distribution for English.

18
English Letter Frequencies

19
Example
• Cipher text:
• UZQSOVUOHXMOPVGPZW………….
• Relative frequency of letter in percentage is:
• P: 13.33 e
• Z: 11.67 t
• S,U,O,M,H  {a,h,i,n,o,r,s} probably frequency.
• ZW: three time repeated in above cipher.
so, z with ‘t’ and w with ‘h’ so ZW->th
next, ZWP -> the
next, ZWSZ -> th_t
20
Polyalphabetic Ciphers
• Monoalphabetic cipher encoded using only
one fixed alphabet. Spaces between words are
still there, these are fairly easy to break.
• So improve security use multiple cipher
alphabets for same plaintext letters.
• make cryptanalysis harder with more
alphabets to guess.
• One such cipher is the famous vigenere
cipher.

21
Vigenère Cipher
• simplest polyalphabetic substitution cipher
• Pick a keyword (example: MEC)
• Write this keyword on top of the plaintext and
repeat it many times if necessary.
• To retrieve cipher text of plain text use vigenere
table. (row: keys letter and column: plaintext letter).
• Keyword: M E C M E C M E C M E C M E C
• Plaintext: w e n e e d m o r e m o n e y
• Cipher : I I P Q I F Y S T Q Q Q Z I A

22
Continued
Vigenere Cipher

Example
We can encrypt the message “She is listening” using the 6-
character keyword “PASCAL”.

23
Continued
Example
Let us see how we can encrypt the message “She is listening”
using the 6-character keyword “PASCAL”. The initial key stream
is (15, 0, 18, 2, 0, 11). The key stream is the repetition of this
initial key stream (as many times as needed).

24
Table: A Vigenere Tableau

25
Security of Vigenère Ciphers
• have multiple ciphertext letters for each
plaintext letter
• hence letter frequencies are hidden.
• start with letter frequencies
– see if look monoalphabetic or not
• if not, then need to determine number of
alphabets, since then can attach each

26
One-Time Pad (Vernam Cipher)
• The cipher will be more secure. Key need not be
repeated. (Random Key)
• The key is used to encrypt and decrypt a single
message and then discarded.
• Key length is same as plaintext msg.
• It is unbreakable scheme. It offer complete security
but in practice, has two fundamental difficulties:
– Problem of making large quantities of random keys.
– Problem of key distribution & protection.

27
One-Time Pad
• Plain text: H O W A R E Y O U
7 14 22 0 17 4 24 14 20
+
OTP: 13 2 1 19 25 16 0 17 23
N C B T Z Q A R X

Initial total: 20 16 23 19 42 20 24 31 43

Mod 26: 20 16 23 19 16 20 24 5 17

Ciphertext: U Q X T Q U Y F R
28
Playfair cipher
• Playfair is multiple letter encryption cipher
• It is based on the use of a 5 x 5 matrix of letters
constructed using keyword.
• Example:
• keyword: “playfair is a diagram cipher”

P L A Y F
I/J R S D G (p1,p2)  (c1,c2)
M C H E B
K N O Q T
U V W X Z
29
Playfair cipher
• Plaintext is encrypted two letters at a time based on following
rules:
me et at fi ve pm be hi nd pl ab.
• p1 & p2 in distinct row & column, then define the corner of a
submatrix. Ex: ET QB.
• P1 & p2 in common row, c1 is defined as the character
immediately to the right of p1 & c2 is defined right of p2. Ex:
ME CB.
• p1,p2 in same column, then character immediately (circularly)
below them are c2 & c3. Ex: PM  IK.
• p1=p2 then infrequent plaintext character(such as x) inserted
between them and regrouped plaintext.
Ex: balloon  ba lx lo on
30
Continued
Playfair Cipher
An example of a secret key in the Playfair cipher

Example :
Let us encrypt the plaintext “hello” using the key in Figure.

31
Hill cipher
• Another Multi letter cipher technique.

• Take m successive plaintext letters and


substitute for them m cipher text letters.

• The substitution is determined by m linear


equations in which each character is assigned
a numerical value.
(a=0,b=1,c=2,…….z=25)
32
Continued
Hill Cipher
Key in the Hill cipher

Note

The key matrix in the Hill cipher needs to


have a multiplicative inverse.
Continued
Example
For example, the plaintext “code is ready” can make a 3 × 4
matrix when adding extra bogus character “z” to the last block
and removing the spaces. The ciphertext is “OHKNIHGKLISS”.

Note: For Matrix Multiplication no. of columns of 1st matrix should be equal to
no. of rows of 2nd matrix.
Continued
Example (Continued)

She makes matrices P and C from these pairs. Because P is


invertible, she inverts the P matrix and multiplies it by C to get
the K matrix as shown.

Now she has the key and can break any ciphertext encrypted
with
3.35 that key.
Transposition Ciphers
• these hide the message by rearranging the
letter order

• without altering the actual letters used

• It can recognise these since have the same


frequency distribution as the original text

36
Rail Fence cipher
• Text is written down as sequence of diagonal.

• Here we consider depth of the diagonal or number of


rows for arranging letters.

• Next, read the letters row by row which gives cipher


text.
• eg. write message out as: (depth=2)
m e m a t r h t g p r y
e t e f e t e o a a t
• giving ciphertext
MEMATRHTGPRYETEFETEOAAT
37
Rail Fence cipher
• eg. write message out as: (depth=3)
m e m a t r h t g p r y
e t e f e t e o a a t

m t a e h o p t
e m f r e g a y
e e t t t a r

• giving ciphertext
mtaehoptemfregayeetttar

38
Row Transposition Ciphers
• a more complex transposition is to write the
message in a rectangle row by row.
• Next, read the message column by column but
specify which order of column to convert plaintext
data into cipher text.
• write letters of message out in rows over a specified
number of columns.

Key: 4 3 1 2 5 6 7
Plaintext: a t t a c k p
o s t p o n e
d u n t i l t
w o a m x y z

Ciphertext: TTNAAPTMTSUOAODWCOIXKNLYPETZ
39
Row Transposition Ciphers
• In double transposition method convert single
transposition cipher text into another cipher text.

Key: 4 3 1 2 5 6 7
Plaintext: t t n a a p t
m t s u o a o
d w c o i x k
n l y p e t z

Ciphertext: NSCYAUOPTTWLTMDNAOIEPAXTTOKZ
40
Continued

Sender and Receiver can agree on the number of columns and


use the second method. Alice writes the same plaintext, row by
row, in a table of four columns.

She then creates the ciphertext “MMTAEEHREAEKTTP”.


41
Continued

The cipher in Example is actually a transposition cipher. The


following shows the permutation of each character in the
plaintext into the ciphertext based on the positions.

The second character in the plaintext has moved to the fifth


position in the ciphertext; the third character has moved to the
ninth position; and so on. Although the characters are
permuted,
there is a pattern in the permutation: (01, 05, 09, 13), (02, 06,
10, 13), (03, 07, 11, 15), and (08, 12). In each section, the
diffrence between the two adjacent numbers is 4. 42
Summary
• Have considered:
– classical cipher techniques and terminology
– monoalphabetic substitution ciphers
– cryptanalysis using letter frequencies
– polyalphabetic ciphers
– transposition ciphers

43

You might also like