Classical Encryption Technique
Classical Encryption Technique
1
SYMMETRIC CIPHER MODEL
Symmetric (conventional) encryption scheme has the following
ingredients
2
SYMMETRIC CIPHER MODEL (CONT 1)
We can write:
Y=EK(X)
X= DK(Y)
Opponent knows Y, E, D. He may be interested to recover X or/and K.
Knowledge of K gives him opportunity to read future messages.
3
CRYPTOGRAPHY
Cryptographic systems are characterized by
1. The type of operations used for transforming plaintext to ciphertext
(substitution, transposition). Fundamental requirement – no information be
lost
2. The number of keys used (1 key – symmetric, single-key, secret-
key; 2 keys – asymmetric, two-key, public-key)
3. The way in which the plaintext is processed (block cipher, stream
cipher). Stream cipher may be viewed as a block cipher with block size
equal to 1 element.
CRYPTANALYSIS
There are two general approaches to attacking a conventional
encryption scheme:
1. Cryptanalysis: attempts to use characteristics of the plaintext or
4
CRYPTANALYSIS (CONT 1)
Unconditionally secure encryption scheme – ciphertext generated by
the scheme does not contain enough information to determine uniquely the
corresponding plaintext, no matter how much ciphertext is available.
Excepting a scheme known as one-time pad, there is no encryption
algorithm that is unconditionally secure. Therefore, encryption algorithm
should meet one or both of the following criteria:
- The cost of breaking the cipher exceeds the value of the encrypted
information
- The time required to break the cipher exceeds the useful lifetime of
the information
Such algorithm is called computationally secure. Table below shows
how much time is involved for various key sizes. The 56-bit key size is used
with the DES (Data Encryption Standard), 168-bit – for triple DES, 128-bit
– for AES (Advanced Encryption Standard). Results are also shown for
substitution codes that use 26-character key, in which all possible
permutations of the 26 characters serve as keys. It is assumed that it take 1
μs to perform a single decryption or encryption (in last column – 106
decryptions per 1 μs)
5
CRYPTANALYSIS (CONT 2)
All forms of cryptanalysis for symmetric encryption try to exploit the
fact that traces of structure or pattern in the plaintext may survive encryption
and be discernible in the ciphertext. Cryptanalysis for public-key schemes
tries to use mathematical properties of pair of keys to deduce one from the
other.
SUBSTITUTION TECHNIQUE
A substitution technique is one in which the letters of plaintext are
replaced by other letters or by numbers. If the plaintext is viewed as a
sequence of bits, then substitution involves replacing plaintext bit patterns
with ciphertext bit patterns
CAESAR CIPHER
It was used by Julius Caesar. The Caesar cipher involves replacing
each letter of the alphabet with the letter standing three places further down
the alphabet
For example
Plain: meet me after the toga party
Cipher: PHHW PH DIWHU WKH WRJD SDUWB
Transformation is made using the following mapping:
Plain: a bc d efgh i j k l mno pq r s t u v wxy 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 a numerical equivalent to each letter from 0 to 25. Then
the algorithm may be expressed as follows. For each plaintext letter p,
substitute the ciphertext letter C:
C=E(p)=(p+3) mod 26
A shift may be of any amount, so that general Caesar algorithm is
6
CAESAR CIPHER (CONT 1)
C=E(p)=(p+k) mod 26,
where k takes on a value in the range 1 to 25. The decryption algorithm is
simply
p=D(C)=(C-k) mod 26
If it is known that a given ciphertext is a Caesar cipher, then a brute-
force cryptanalysis is easily performed: simply try all possible 25 keys.
Three important characteristics of this problem enable us to use brute-
force cryptanalysis:
1. The encryption and decryption algorithms are known
2. There are only 25 keys to try
3. The language of the plaintext is known and easily recognizable
In most networking situations algorithms are assumed to be known.
Brute-force analysis is impractical when algorithm employs large of keys.
The 3rd characteristic is also significant. If the language of the plaintext is
not known, then the plaintext output may not be recognizable.
7
CAESAR CIPHER (CONT 2)
8
CAESAR CIPHER (CONT 3)
Furthermore, if the input is compressed in some manner, again
recognition is difficult. Below is example of compression by ZIP:
the cipher line can be any permutation of the 26 alphabetic symbols, then
there are 26! or greater than 4*1026 possible keys. There is however another
line of attack. If the cryptanalyst knows the nature of the plaintext (e.g.,
noncompressed English text), then the analyst can exploit the regularities of
the language.
9
MONOALPHABETIC CIPHERS (CONT 1)
Let’s consider example of ciphertext:
UZQSOVUOHXMOPVGPOZPEVSGZWSZOPFPESXUDBMETSXAIZ
VUEPHZHMDZSHZOWSFPAPPDTSVPQUZWYMXUZUHSX
EPYEPOPDZSZUFPOMBZWPFUPZHMDJUDTMOHMQ
10
MONOALPHABETIC CIPHERS (CONT 2)
11
MONOALPHABETIC CIPHERS (CONT 3)
UZQSOVUOHXMOPVGPOZPEVSGZWSZOPFPESXUDBMETSXAIZ
t a e e te a t h at e e a a
VUEPHZHMDZSHZOWSFPAPPDTSVPQUZWYMXUZUHSX
e t ta t ha e ee a e th t a
EPYEPOPDZSZUFPOMBZWPFUPZHMDJUDTMOHMQ
e e e tat e t he et
Continued analysis of frequencies plus trial and error may lead us to
the solution:
12
PLAYFAIR CIPHER (CONT 1)
The Playfair algorithm is based on the use of a 5x5 matrix of letters
constructed using a keyword. In the case of keyword monarchy, matrix is as
follows:
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
replaced with 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 letters that fall in the same column are each replaced by
the letter beneath, with the top element of the row circularly following the
last. For example, mu is encrypted as CM.
13
PLAYFAIR CIPHER (CONT 2)
4. Otherwise, each plaintext letter is replaced by the letter that lies in
its own row and the column occupied by the other plaintext letter. Thus, hs
becomes BP, and ea becomes IM (or JM, as the encipherer wishes).
As far as number of digrams is 26x26=676 is significantly greater than
number of letters, frequency analysis becomes much more difficult. For
these reasons, Playfair cipher was for a long time considered unbreakable. It
was used as standard field system by the British Army in World War I and
still enjoyed considerable use by U.S.Army and other Allied forces during
World War II.
Despite this level of confidence in its security, the Playfair cipher is
relatively easy to break because it still leaves much of the structure of the
plaintext language intact. A few hundred letters of ciphertext are generally
sufficient.
HILL CIPHER
It was developed by the mathematician Lester Hill in 1929. The
encryption algorithm takes m successive 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 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 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 25
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4
14
HILL CIPHER (CONT 1)
This can be expressed in terms of column vectors and matrices:
C=KP mod 26,
where C and P are column vectors of length 3, representing the plaintext and
ciphertext, and K is 3x3 matrix, representing the encryption key.
Operations are performed mod 26.
For example, consider the plaintext “payformoney”, and use the
encryption key
K=
17 17 5
21 18 21
2 2 19
The first 3 letters of the plaintext are represented by the vector (15 0
24). Then K(15 0 24) = (375 819 486) mod 26 = (11 13 18) = LNS.
Continuing in this fashion, the ciphertext for the entire plaintext is
LNSHDLEWMTRW.
Decryption requires using the inverse of the matrix K. The inverse K-1
of a matrix K is defined by K K-1 = K-1 K=I, where I is the unit matrix (1-s
on the diagonal, other elements – zeroes). The inverse of the matrix does not
always exist, but when it does, it satisfies the preceding equation. In this
case, the inverse is
15
HILL CIPHER (CONT 2)
K-1=
4 9 15
15 17 6
24 0 17
16
HILL CIPHER (CONT 3)
Then we can form matrix equation Y=KX. If X has an inverse, then
we can determine K=YX-1. If X is not invertible, then a new version of X
can be formed until an invertible X is obtained.
Suppose that the plaintext “friday” is encrypted using a 2*2 Hill cipher
to yield the ciphertext PQCFKU. Thus, we know that
K(5 17) = (15 16);
K(8 3) = (2 5);
K(0 24) = (10 20).
Using the first 2 plaintext-ciphertext pairs, we have
1 5 2 5 8
= K m o2d6
1 6 5 1 7 3
The inverse of X can be computed:
−1
5 8 9 2
=
1 7 3 1 1 5
1 5 2 9 2 1 3 7 6 0 7 8
K = = m o2 d6=
1 6 5 1 1 5 1 4 9 1 0 7 1 9 3
Let’s check now that this key matrix produces required
transformation:
7 8 5 3 5+ 1 3 6 1 7 1 1 5
= = m o 2d 6=
1 9 3 1 7 9 5+ 5 1 1 4 6 1 6
17
7 8 8 5 6+ 2 4 8 0 2
= = m o 2d 6=
1 9 3 3 1 5 2+ 9 1 6 1 5
7 8 0 1 9 2 1 0
= m o 2d 6=
1 9 3 2 4 7 2 2 0
18