LECTURE NOTES ON Classical Cryptographic Techniques ( Substitution Ciphers System) By

advertisement
The University of Babylon
Department of Software
LECTURE NOTES ON Classical Cryptographic
Techniques ( Substitution Ciphers System)
By
Dr. Samaher Hussein Ali
College of Information Technology, University of Babylon, Iraq
Samaher@itnet.uobabylon.edu.iq
5 October 2013
Homophonic System
In the substitution system the relation between the text and key is one to one. In this type the relation is one to many (i.e each
letter can enciphered in multi images)
Example:Plain text letter
A
I
L
N
O
P
T
Cipher text homophonic letters
17,19,34,41,56,60,67,83
08,22,53,65,88,90
03,44,76
02,09,15,27,32,40,59
01,11,23,28,42,54,70
33,91
05,10,20,29,45,58,64,78,99
Example:
Plain Text: PILOT
Cipher Text: 91 88 76 70 99
Plain Text : ALL
Cipher Text :19 76 03
5 October 2013
Dr. Samaher Hussein Ali
Notes of Lecture 4
Polyalphabetic substitution ciphers
Polyalphabetic substitution ciphers have multiple one-letter keys, each of which is used to encrypt one letter of the
plaintext. The first key encrypts the first letter of the plaintext, the second key encrypts the second letter of the plaintext,
and so on. After all the keys are used, the keys are recycled. If there were 20 one-letter keys, then every twentieth letter
would be encrypted with the same key. This is called the period of the cipher. In classical cryptography, ciphers with longer
periods were significantly harder to break than ciphers with short periods. There are computer techniques that can easily
break substitution ciphers with very long periods.
5 October 2013
Dr. Samaher Hussein Ali
Notes of Lecture 4
Polyalphabetic substitution ciphers
There might be five different simple substitution ciphers used:
1. Vigenère cipher
2. Beaufort cipher
3. Beale cipher also called (book cipher) where the key string is an agreed
text in a book.
4. Hill cipher
5. Permutation cipher
6 October 2013
Dr. Samaher Hussein Ali
Notes of Lecture 4
1. The Vigenere cipher
Note : When key length is less than the length of text to be ciphered we repeat the key letters to be equal to the plain text
letters.
Plaintext : Computer
Key : sun
We can draw only a partial table containing the key letters as follows
 Cipher : The cipher text letters can be found by taking the letters apposing the key letters from the above table as follows
comput er
sun sunsu
u i z h o g w l (the cipher text)
 Decipher:
 The key letters are spreaded over the cipher text. When two letters crossected on the same row ,then the letter above the
crossection in the outside row is the plaintext letter.
5 October 2013
Dr. Samaher Hussein Ali
Notes of Lecture 4
The Vigenere cipher
Example
Plaintext : Good Student
Key
: exam
Solution :
goodst u d ent
examexamexa
Cipher Text :
klopwqupIk t
Decipher
As a Result, The Vigenere cipher
In the Vigenere cipher the key consists of a string of k letters. These are written repeatedly below the message (from which
all spaces have been removed). The message is then encrypted a letter at a time by adding the message and key letters
together, working mod 26 with the letters taking values A = 0 to Z = 25. For example if the key is the three letter sequence key
then the message 1
5 October 2013
Dr. Samaher Hussein Ali
Notes of Lecture 4
The Vigenere cipher
M = THISISTHEMESSAGE
is encrypted using
K = KEYKEYKEYKEYKEY
To give the cryptogram
C=DLGCMQDLCWIQCEEO.
The vigeneer cipher is slightly stronger than simple substitution. To attack it using frequency analysis is more difficult since
the encryption of a particular letter is not always the same .However it is still trivial to break given a reasonable amount of
ciphertext.
Then,
C=((P+Ki)-1) Mod n
P= (C-Ki)+1) Mod n
Let C= Cipher Text
P= Plain Text
Ki= Key;
n =26 , of English alphabetic
5 October 2013
Dr. Samaher Hussein Ali
Notes of Lecture 4
2. Set of keys Method
The monoalphabetic is easily to analysed using statistical features of the letters of the language.Here we assume that we
have k distinct bijenctions f1,f2,…,fk from the normal alphabet to the set of cipher to represent an encryption of a word.It
uses k different alphabets, the index set {1,2,…,k} is called the set of keys.
Example:
Let us consider a simple example using three keys with three values (a,b)=(1,3); (3,5);(2,5) in turn to give the encryption
of a short text.
If we want to encrypt the following message “The international islamic university provides a scientific basis for the mutual
interaction of the natural science and Islam
Using 3 keys of mixed alphabets with the encryptions f1,f2,f3 .
f1 = a1 X + b1 (i,e., a1 = 1, b1 = 3)
f2 = a2 X + b2 (i,e., a2 = 3, b2 = 5)
f3 = a3 X + b3 (i,e., a3 = 2, b3 = 5)
then we have to do as follows
f1 (T)=W, f2 (H)=A, f3 (E)=W,
f1 (I)=L, f2 (N)=S, f3 (T)=T
f1 (E)=H, f2 (R)=E, f3 (N)=P,
f1 (A)=D, f2 (T)=K, f3 (I)=Q
The total encryption of text will be
“Thein terna tiona lisla micun ivers itypr ovide sasci entif icbas isfor themu tuali ntera ction ofthe natur alsci ences andIs
lamxx”
comes to be the string of ciphers
“WAWLS THEPD KQRSC ODOOF KLLYQ DDHEO LKSSE UYDRH HCVLQ HSTLU QFICV DOIVJ WAWPN TXFFL ………
5 October 2013
Dr. Samaher Hussein Ali
Notes of Lecture 4
3. Digraph Cipher Method
Consider the rule “a group of k subsequent letters” changes into another “group of k subsequent letters” this is called “Digraph
cipher” . In this case the plain text alphabet consists of all two letters combinations of the ordinary alphabet that’s giving
262=676 symbols
P=(aa,bb,ac,…,ba,bb,bc,…zx,zy,zz) then we get the all ordered pairs that is all vectors
(xy) Є (Z/26)2.
The American mathematician Laster Hill suggested a procedure for encryption decryption such vectors by using matrices as
follows
 p q
A=


r s 
with p,q,r,s Є Z/26. then weobtain the linear transformation
X1=px + qy
Y1=rx + sy
which may be regard as an encryption function .This transformation is bijective iff gcd(ps-qr,26)=1 in this case the decryption
function corresponds to the inverse matrix
 p  q

 r s 
A-1=1/d . 
Where d=ps – qr
Example :
Let ,
1 2 

A  
3 7
Of determinant 1.if we want to encrypt the word MALAYSIA we have to form the corresponding numerical string
(12,0,11,0,24,18,8,0) and break it up into 4-pairs and then compute the image vectors under the transformation A.Hence we
get
A(12o)=(1210),A(110)=(117), A(2418)=(86), A(80)=(8 24) yielding the encryption “MKLHIGIY”
5 October 2013
Dr. Samaher Hussein Ali
Notes of Lecture 4
3. Digraph Cipher Method
As a result, the rule is change “a group of k subsequent lettersinto another “group of k subsequent letters”
Procedure of Encryption:
𝑥
1. Convert the Plain text into pairs of Digital number 𝑦
2. Using the following matrix
 p q


r
s


𝑥1
cipher text =
𝑦1
A=
3.
𝑥1
=
𝑦1
……..condition (ps-qr=1)
𝑝 𝑞 𝑥 𝑝𝑥 + 𝑞𝑦
=
𝑟 𝑠 𝑦 𝑟𝑥 + 𝑠𝑦
Procedure of Decryption:
Note: we cab be perform the decryption iff (GCD(ps-qr,26)=1)
1. A-1=1/d .
2.
s q 


 r p
𝑥
𝑥1
−1
𝑦 = 𝐴 ∗ 𝑦1 =Plain Text
 Return to example: (Encryption)
𝑥1
1 2 12
12
12
= (
) Mod 26 =
𝑚𝑜𝑑 26=
𝑦1
3 7 0
36
10
5 October 2013
Dr. Samaher Hussein Ali
Notes of Lecture 4
3. Digraph Cipher Method
Return to example: (Decryption)
GCD( ps-rq,26)= GCD(“7-6”,26)=GCD(1,26)=1, Then , we can perform the decryption
1.
s q 
A-1=1/d . 


 r
p
d=ps-qr=(7-6)=1
𝐴−1 =
7  2


3 1 
𝑥
𝑥1
 7  2
−1
𝑦 = 𝐴 ∗ 𝑦1 = (   3 1 


5 October 2013
*
12
) mod 26 =
10
84 − 20 𝑚𝑜𝑑 26
12
𝑀
=
=
−36 + 10 𝑚𝑜𝑑 26
0
𝐴
Dr. Samaher Hussein Ali
Plain Text
Notes of Lecture 4
Download