1 
Chapter 2: Cryptography with 
Classical Cipher 
Faculty of Physical and Basic Education 
Computer Science 
By: Msc. Karwan M. Kareem 
2014 - 2015 
© University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
Topics 
Basic concepts of Cryptography 
Secret writing with Cryptography 
Cipher 
Cipher Types 
Substitution Cipher 
Substitution Cipher Types 
1945 
1964 
2 
 Monoalphabetic Cipher 
 Polyalphabetic Cipher 
 Polygram Cipher 
 Homophonic Cipher 
 Transposition Cipher 
Transposition Cipher Type 
 Rail Fence Cipher 
 Route Cipher 
 Simple Columnar Cipher 
 Keyword Columnar Cipher 
© University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
Basic concepts of Cryptography 
 Basic Concepts ( terminology) 
 Plaintext : the original message. 
 Ciphertext : the 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 ciphertext from plaintext. 
 Cryptography : study of encryption principles/methods. 
 Cryptanalysis (code breaking) : the study of principles/ methods of deciphering 
ciphertext without knowing key. 
 Cryptology : the field of both cryptography and cryptanalysis 
3 
© University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
Basic concepts of Cryptography 
 Cryptography 
 Cryptography is the science of providing security for information. 
 Process or Practice of the enciphering and deciphering of messages in secret 
code. 
 It has been used to obtain secure communication between individuals, 
government agencies, banking, and military forces. 
 The principles of cryptography are today applied to the encryption of FAX, 
TELEVISION and computer Network communications 
 Cryptanalysis 
The procedures, processes, methods, etc., used to translate or interpret 
secret writings (encrypted messages) into plaintext without known the secret 
key. 
4 
Cryptology: the scientific study of cryptography and cryptanalysis 
Cryptology  Cryptography + Cryptanalysis 
© University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
Secret writing with Cryptography 
Polygram 
Cipher 
Affine Cipher Atbash Cipher ROT13 Cipher Caesar Cipher 
5 
Homophonic 
Cipher 
 NOTE: 
Secret Writing 
Cryptography 
(scrambled) 
Classical 
Ciphers 
Substitution 
Mono 
alphabetic 
Cipher 
Polyalphabetic 
Cipher 
Vigenère 
Cipher 
Beaufort 
Cipher 
Rail Fence 
Cipher 
One Time Pad 
Cipher 
 Cryptography does not hide the existence of messages. 
 Steganography hides even the existence of a message. 
Playfair 
Cipher 
Transposition 
Simple 
Columnar 
Cipher 
Keyword 
Columnar 
Ciphe 
© University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015 
Route Cipher 
Modern 
Ciphers 
Steganography 
(hidden)
Cipher 
 Cipher 
In Cryptography, a cipher is an algorithm for performing encryption or decryption. It 
can be Symmetric or Asymmetric “a way of changing a message to keep it secret”. 
 Symmetric (Private-key cryptography): In Symmetric Key Algorithms same key used 
for encryption and decryption. 
 Asymmetric (Public-key cryptography): In Asymmetric Key Algorithms different 
keys used for encryption and decryption. 
Stream ciphers encrypt the digits (typically bits) of a message one at a time. 
Block ciphers take a number of bits and encrypt them as a single unit (Block), 
Blocks of 64 or 128 bits have been commonly used. 
 There are two types of ciphers: 
1. Classical Ciphers 
2. Modern Ciphers 
6 
© University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
Cipher Type 
1. Classical Ciphers 
A classical cipher is a type of cipher that was used historically. In general, classical 
ciphers operate on an alphabet of letters (such as "A-Z"), and are implemented by hand 
or with simple mechanical devices. 
Sender and Recipient share a same key. 
All classical encryption & decryption algorithms are Symmetric. 
Classical Cipher Types: 
Substitution Cipher 
Transposition Cipher 
Substitution Cipher 
Is a method of encryption by which units of plaintext are replaced 
with Ciphertext, according to a regular systems. 
Substitution Cipher Types 
1- Monoalphabetic Cipher 2- Polyalphabetic Cipher 3- Polygram Cipher. 
7 4- Homophonic Cipher. 
© University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
Substitution Cipher Type 
 Substitution Cipher Types 
1.Monoalphabetic Cipher 
The Monoalphabetic substitution cipher is so called because each plain text letter is 
substituted by the same cipher text letter throughout the entire message. 
Example: 
In the cipher table below, plaintext ‘ r ’ is always replaced by cipher text ‘ H ’. 
8 
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 
X D G S Z A N Y O B T M J C E V F H K W P L Q U R I 
Plain Text: 
Cipher Text: 
© University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
Substitution Cipher Type 
 Substitution Cipher Types 
1. Monoalphabetic Cipher Types 
Monoalphabetic Cipher is oldest and weakest cipher method. 
Monoalphabetic Cipher can be broken through the use of Frequency Analysis 
method. 
The most famous methods of this type are: 
A.Caesar Cipher. 
B.ROT13 Cipher. 
C.Atbash Cipher. 
D.Affine Cipher. 
9 
© University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
Substitution Cipher Type 
 Substitution Cipher Types 
1.Monoalphabetic Cipher Types 
A.Caesar Cipher 
Caesar Cipher is One of the simplest examples of a substitution cipher, which 
have been used by Julius Caesar to communicate with his army. 
Caesar is considered to be one of the first persons to have ever employed 
encryption for the sake of securing messages. “ Caesar used a shift of 3”. 
Encryption Method: C = P + K Key Always = 3 
Decryption Method: P = C - K Key Always = 3 
Example: 
Plain Text: ZAGROS Key = 3 
Cipher Text: CDJURV 
10 
© University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
Substitution Cipher Type 
 Substitution Cipher Types 
1.Monoalphabetic Cipher Types 
B. ROT13 Cipher 
ROT13 is a simple encryption cipher. It is a variant of the Caesar Cipher. 
 Encryption Method: C = P + K Key Always = 13 
 Decryption Method: P = C - K Key Always = 13 
 Example: 
Plain Text: HELLO Key = 13 
Cipher Text: URYYB 
11 
© University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
Substitution Cipher Type 
 Substitution Cipher Types 
1.Monoalphabetic Cipher Types 
C. Atbash Cipher 
Atbash is a simple substitution cipher for the Hebrew alphabet. Using this method 
sometimes the encrypted words has another meaning. 
 Encryption Method: Reversing each letter once. 
 Decryption Method: Reversing each letter once. 
An Atbash cipher for Hebrew 
alphabet; 
Plain: אבגדהוזחטיכלמנסעפצקרשת 
Cipher: תשרקצפעסנמלכיטחזוהדגבא 
An Atbash cipher for English alphabet; 
Plain: abcdefghijklmnopqrstuvwxyz 
Cipher: zyxwvutsrqponmlkjihgfedcba 
 Example: 
12 
© University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
Substitution Cipher Type 
 Substitution Cipher Types 
1.Monoalphabetic Cipher Types 
D. Affine Cipher 
In Affine Cipher each letter in an alphabet is mapped to its numeric equivalent as 
shown below; 
 English alphabet is 26 character therefore ( m = 26 ). 
 This method uses two keys “ K1 & K2 ”. We will call K1 (A) & K2 (B). 
 K1 can have a value from “1, 3, 5, 7, 9, 11, 13, 15, ……..……. Up to 25” 
 K2 can have a value from “0, 1, 2, 3, 4, 5, 6, 7, 8, 9, …………. Up to 25” 
 Encryption Method C = ( A * P) + B (mod m) 
Decryption Method P _=1 A * (C - B) (mod m) 
13 
© University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
 Substitution Cipher Types 
1.Monoalphabetic Cipher Types 
D. Affine Cipher 
 Example: Plaintext: KURDISTAN K1 (A) = 5 & K2 (B) = 8 Ciphertext: 
Encryption Method C = (A * P) + B (Mod m) 
C = (5 * 10) + 8 (Mod m) = 58 mod 26 = 6 = G 
C = (5 * 20) + 8 (Mod m) = 108 mod 26 = 4 = E 
C = (5 * 17) + 8 (Mod m) = 93 mod 26 = 15 = P 
C = (5 * 3) + 8 (Mod m) = 23 mod 26 = 23 = X 
C = (5 * 8) + 8 (Mod m) = 48 mod 26 = 22 = W 
C = (5 * 18) + 8 (Mod m) = 98 mod 26 = 20 = U 
C = (5 * 19) + 8 (Mod m) = 103 mod 26 = 25 = Z 
C = (5 * 0) + 8 (Mod m) = 8 mod 26 = 8 = I 
C = (5 * 13) + 8 (Mod m) = 73 mod 26 = 21 = V 
Substitution Cipher Type 
14 
© University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
Substitution Cipher Type 
 Substitution Cipher Types 
1.Monoalphabetic Cipher Types 
D. Affine Cipher 
 Example: Plaintext: GEPXWUZIV K1(A) = 5 & K2(B) = 8 Plaintext: 
_1 
Decryption Method P = A * (C - B) (Mod m) 
P = 21 * (6 - 8) (Mod m) = -42 mod 26 = 10 = K 
P = 21 * (4 - 8) (Mod m) = -84 mod 26 = 20 = U 
P = 21 * (15 - 8) (Mod m) = 147 mod 26 = 17 = R 
P = 21 * (23 - 8) (Mod m) = 315 mod 26 = 3 = D 
P = 21 * (22 - 8) (Mod m) = 294 mod 26 = 8 = I 
P = 21 * (20 - 8) (Mod m) = 252 mod 26 = 18 = S 
P = 21 * (25 - 8) (Mod m) = 357 mod 26 = 19 = T 
P = 21 * (8 - 8) (Mod m) = 0 mod 26 = 0 = A 
P = 21 * (21 - 8) (Mod m) = 273 mod 26 = 13 = N 
-42 mod 26 = -16 
= 26 -16 
= 10 = K 
-84 mod 26 = - 6 
= 26 - 6 
= 20 = U 
147 mod 26 = 17 = R 
15 
© University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
Substitution Cipher Type 
 Substitution Cipher Types 
2. Polyalphabetic Cipher 
Leon Battista invented the Polyalphabetic Substitution Cipher in year 1568. “Poly 
means Many in Greek language”. This method uses a mixed alphabet to encrypt a 
message. These were thought to be unbreakable for almost 300 years. 
 The Enigma machine is more complex but still fundamentally a polyalphabetic 
substitution cipher. 
Polyalphabetic Cipher Types 
A.Vigenère Cipher 
B.Beaufort Cipher 
C.One Time Pad Cipher 
D.Playfair Cipher 
16 
© University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
Substitution Cipher Type 
 Substitution Cipher Types 
2. Polyalphabetic Cipher Types 
A.Vigenère Cipher (Using Code Wheel) 
A tool that was used for the Vigenère Cipher was a code wheel. The outer ring of the 
wheel represented plaintext letters and the inner wheel represented Ciphertext letters. 
 Encryption Method: Go to the plaintext letter in the outer wheel and find its 
corresponding Ciphertext letter. 
 Encryption Method: Position the keyword letter under “A” but go from the inner 
Ciphertext wheel to the outer plaintext wheel. 
17 
© University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
Substitution Cipher Type 
 Substitution Cipher Types 
2. Polyalphabetic Cipher Types 
A.Vigenère Cipher (Using Code Wheel) 
 Example: 
Plain Text: KURD 
Key = S 
Cipher Text: 
K = C 
U = M 
R = J 
CMJV D = V 
Decrypt this; “ DGNW “ Key = S & Use Code Wheel 
18 
© University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
Substitution Cipher Type 
 Substitution Cipher Types 
2. Polyalphabetic Cipher Types 
A.Vigenère Cipher (Using Keyword) 
 Example1: 
Plain Text: “ on a plane the plane is due ” Key = milk 
Cipher Text: ? 
• Encode plain text. 
• Write key under coded plaintext, repeating as many times as necessary. 
• Encode key. 
• Add key character code to corresponding plain text code (mod 26). 
• Decoding of resulting integer is Ciphertext. 
• Note: If (Pencoding + Kencoding) >= 26 then - 26 
19 
© University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
 Substitution Cipher Types 
2. Polyalphabetic Cipher Types 
A.Vigenère Cipher (Using Keyword) 
 Example1: Answer 
+ 
 Note: If (Pencoding + Kencoding) >= 26 then - 26 
Substitution Cipher Type 
20 
© University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
Substitution Cipher Type 
 Substitution Cipher Types 
2. Polyalphabetic Cipher Types 
A.Vigenère Cipher (Using Keyword) 
 Example2: Ciphertext: “ avlzxiyofppzxiyouaoep ” Key = milk Plaintext: ? 
_ 
0 – 12 = – 12 26 – 12 = 14 
21 
© University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
Substitution Cipher Type 
 Substitution Cipher Types 
2. Polyalphabetic Cipher Types 
A.Vigenère Cipher (Using Keyword) 
Difficulty of Vigenère cipher 
 The longer the keyword, the more difficult it will be for a third person to crack it. 
 In fact, for any plain text and any cipher text of the same length, there is a key 
that connects them. 
 Example: 
 consider the plain text: “ enter plain text here ” 
 The key connecting them (ignoring spaces) is: “ arlanptewrlahlxan ” 
 The cipher text will be: “ eeeee eeeee eeee eeee ” 
22 
© University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
Substitution Cipher Type 
 Substitution Cipher Types 
2. Polyalphabetic Cipher Types 
B. Beaufort Cipher 
The Beaufort cipher, created by Sir Francis Beaufort, The Beaufort cipher is 
a Reciprocal Cipher that is, Encryption and Decryption algorithms are the same. 
Encryption & Decryption Methods: 
 Firstly, choose the plaintext character from the top row of the tableau, call this 
column P. 
 Secondly, travel down column P to the corresponding keyLetter K. 
 Finally, move directly left from the Key letter to the left edge of the tableau, the 
Ciphertext encryption of Plaintext P with Key K will be there. 
 Example: Plaintext: “ HOW STUFF WORKS ’’ Key = CIPHER 
23 
© University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
Substitution Cipher Type 
 Substitution Cipher Types 
2. Polyalphabetic Cipher Types 
B. Beaufort Cipher 
Example: Answer 
24 
© University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
Substitution Cipher Type 
 Substitution Cipher Types 
2. Polyalphabetic Cipher Types 
C. One Time Pad Cipher 
known as Vernam Cipher is implemented using a random set of non repeating 
characters as the Key. The rest of process is same as the Vigenère cipher. 
Example1: Plaintext: “ HOW ARE YOU ’’ Key = NCBTZQARX Ciphertext: ? 
 Note: If (Pencoding + Kencoding) >= 26 then - 26 
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 26 
+ 
25 
© University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
 Substitution Cipher Types 
2. Polyalphabetic Cipher Types 
C. One Time Pad Cipher 
Example2: Ciphertext: “ UQXTQUYFR ’’ Key = NCBTZQARX Plaintext: ? 
_ 
16 – 25 = – 9 26 – 9 = 17 
Substitution Cipher Type 
26 
© University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
Substitution Cipher Type 
 Substitution Cipher Types 
2. Polyalphabetic Cipher Types 
D. Playfair Cipher 
The Playfair cipher encrypts pairs of letters, instead of single letters. This is 
significantly harder to break. Each plaintext letter is replaced by a diagram in this 
cipher. 
 User chooses a keyword and puts it in the cells of a 5 x 5 matrix. 
 Letter I and J always stay in one cell . 
 Duplicate letters appear only once. 
 Number of diagrams is 26 x 26 = 676. 
27 
© University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
Substitution Cipher Type 
 Substitution Cipher Types 
2. Polyalphabetic Cipher Types 
D. Playfair Cipher 
Playfair Cipher Rules 
 Group plaintext letters two at a time. 
 Separate repeating letters with an x. 
 Plaintext letters in the same row are replaced by letters to the right. 
 Plaintext letters in the same column are replaced by letters below. 
 Plaintext letters in different row and column are replaced by the letter in the 
row corresponding to the column of the other letter and vice versa. 
28 
© University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
Substitution Cipher Type 
 Substitution Cipher Types 
2. Polyalphabetic Cipher Types 
D. Playfair Cipher 
 Example1: Plaintext: CRYPTO IS TOO EASY Key = INFOSEC Ciphertext: ?? 
Grouped text: CR YP TO IS TO XO EA SY 
Ciphertext: AQ TV YB NI YB YF CB OZ 
29 
© University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
Substitution Cipher Type 
 Substitution Cipher Types 
2. Polyalphabetic Cipher Types 
D. Playfair Cipher 
 Example2: Ciphertext: AQTVYBNIYBYFCBOZ Key = INFOSEC Plaintext: ?? 
Grouped text: AQ TV YB NI YB YF CB OZ 
Plaintext: CR YP TO IS TO XO EA SY 
 To Decrypt: The receiver reconstructs the 5 x 5 matrix using the 
keyword and then uses the same rules as for encryption. 
30 
© University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
Substitution Cipher Type 
Substitution Cipher Types 
3. Polygram Cipher 
This cipher technique, replaces one block of plain text with a block of cipher text, it does 
not work on a character by character basis. This cryptosystem make cryptanalysis 
harder by destroying the single character frequencies. 
 Example: 
 HELLO HELL Could be replaced by “ YUQQW TEUI ”. 
 CAUSE OF BECAUSE Could be replaced by “ XAYWQOA MH IGAYK ” 
 Despite the characters of the four blocks of text being almost the same. 
 Problems in PolyGram Substitution: 
Different keys are required for each block of characters. The encryption and decryption 
technique is applied to each and every block of character of a text differently: even 
when the block is repeated in the plain text. So it requires more time for encryption. 
31 
© University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
Substitution Cipher Type 
 Substitution Cipher Types 
4. Homophonic Cipher 
In this cipher technique, , plaintext letters map to more than one cipher text symbol. 
Usually, the highest-frequency plaintext symbols are given more equivalents than lower 
frequency letters. In this way, the frequency distribution is flattened, making analysis 
more difficult. 
 Since more than 26 characters will be required in the cipher text alphabet, various 
solutions are employed to invent larger alphabets such as a numeric substitution, 
uppercase, lowercase, upside down, and fanciful symbols etc. 
 A Mantua Homophonic Cipher (15th century, Roman Empire) is an example to this 
type of cipher. 
32 
© University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
Substitution Cipher Type 
 Substitution Cipher Types 
4. Homophonic Cipher 
 Example: 
Plaintext: HE EATS THEN SLEEPS AND DREAMS Ciphertext: ?? 
Key: The following table is the key. 
Ciphertext: 
55QP69 11JJK 77OG?? 4987PB 99101ZS XXAZBB 58ND43 DD@AA 88 
33 
© University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
Transposition Cipher 
 Transposition Cipher 
Is a method of encryption by which the positions held by units of plaintext are shifted 
according to a regular system. 
Transposition Cipher Types 
1.Rail Fence Cipher. 
2.Route Cipher. 
3.Simple Columnar Cipher. 
4.Keyword Columnar Cipher. 
34 
© University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
Transposition Cipher Type 
 Transposition Cipher types 
1.Rail Fence Cipher 
The Rail Fence Cipher involves writing messages so that alternate letters are written 
on separate upper and lower lines. The security of the cipher can be improved by 
choosing more than two lines to encrypt your message with. 
 Example1: Rail fence of depth 2 
 To encrypt, write the plaintext in a zigzag pattern in two rows and form the cipher 
text by reading off the letters from the first row followed by the second. 
 To decrypt, write the cipher text in two rows and read off the plaintext in a zigzag 
fashion. 
35 
© University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
Transposition Cipher Type 
 Transposition Cipher types 
1.Rail Fence Cipher 
 Example2: Rail fence of depth 3 
Plain text: meet me after the toga party 
Row 1: m m t h g r 
Row 2: e t e f e t e o a a t 
Row 3: e a r t p y 
Cipher Text: MMTHGRETEFETEOAATEARTPY 
Decrypt this: “ IOEUDSALVKRITN “ Key: Rail fence of depth 3 
Decrypt this: “ IWTKGAAAEHNSOOMKATD “ Key: Rail fence of depth 3 
36 
© University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
 Transposition Cipher types 
2. Route Cipher 
In a route cipher, the plaintext is first written out in a grid of given dimensions, then 
read off in a pattern given in the key. 
 Example1: 
Plain Text: meet me after the toga party at seven clock 
Key = 5 Rows & 
Row 1: m e r o r s c 
Row 2: e a t g t e l 
Row 3: e f h a y v o 
Row 4: t t e p a e c 
Row 5: m e t a t n k 
Cipher Text: kcolcsroremeetmetatnevetgtaftepayah 
(35 letters “ 35 / 5 = 7”) 
Transposition Cipher Type 
37 
© University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
Transposition Cipher Type 
 Transposition Cipher types 
2. Route Cipher 
 Example 2: 
Cipher Text: meetmetaxxytroreaftepagth 
Key = 5 Rows & 
Plain Text: ? 
38 
© University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
Transposition Cipher Type 
 Transposition Cipher types 
2. Route Cipher 
 Example 3: 
Cipher Text: MTETTEEFEATPHAMETAANKEYGROTVCOERSIC 
Key = 7 Columns & 
Plain Text: meet me after t?he toga party at seven clock 
39 
© University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
Transposition Cipher Type 
 Transposition Cipher types 
3. Simple Columnar Cipher 
This cipher technique simply arranges the plain text as a sequence of rows of a 
rectangle that are read in columns. 
 Example1: 
Plain Text: HELLOWORLD Key = 2 Columnar 
Column 1 Column 2 
H E 
L L 
O W 
O R 
L D 
Cipher Text: HLOOL ELWRD 
40 
© University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
Transposition Cipher Type 
 Transposition Cipher types 
3. Simple Columnar Cipher 
 Example 2: 
Plain Text: HELLOWORLD Key = 3 Columnar 
Column 1 Column 2 Column 3 
H E L 
L O W 
O R L 
D X X 
Cipher Text: HLODEORXLWLX 
Decrypt this; “ ICVTNTOALEHKODMERASGX “ Key = 3 Columnar 
41 
© University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
Transposition Cipher Type 
 Transposition Cipher types 
4. Keyword Columnar Cipher 
This cipher technique simply arranges the plain text as a sequence of rows of a 
rectangle that are read in columns according to the keyword. 
 If the keyword has six letters in it. That means that there are six columns, and 
each column must have the same number of letters. 
 The columns are ordered alphabetically according to the letters in the keyword. 
 Example1: 
Plain Text: defend the east wall of the castle Keyword = GERMAN 
1st Step 2nd Step 
Cipher Text: nalcxehwttdttfseeleedsoaxfeahl 
42 
© University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
Transposition Cipher Type 
Transposition Cipher types 
4. Keyword Columnar Cipher 
 Example 2: 
Cipher Text: “ADDSHBGSAROLGNNVCAIISFWDIAOTRNLSAUFRLLWLOENWEHIC” 
Keyword = GILLIGAN 
Plain Text: ? 
1st Step 2nd Step 
Plain Text: “ GILLIGANS ISLAND WAS A WONDERFUL TV SHOW FOR CHILDREN ” 
43 
© University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
END 
END… 
Any questions..? 
Hope you have been happy 
Thank you 
By: Msc. Karwan M. Kareem 
2014 - 2015 
44 
© University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015

More Related Content

PPTX
Cryptography
PPT
6. cryptography
PPTX
hill cipher
PPTX
Cryptography and network security
PPT
DES (Data Encryption Standard) pressentation
PPTX
Cryptography
PPT
DES-lecture (1).ppt
Cryptography
6. cryptography
hill cipher
Cryptography and network security
DES (Data Encryption Standard) pressentation
Cryptography
DES-lecture (1).ppt

What's hot (20)

PPT
Symmetric Key Algorithm
PPTX
Block ciphers & public key cryptography
PPTX
RSA Algorithm
PPTX
Cryptography
PPT
Cryptography ppt
PPTX
Cryptography.ppt
PPTX
Cryptography
PPTX
PPTX
Cryptography
PDF
An introduction to X.509 certificates
PDF
Introduction to Cryptography
PPTX
Applications of-linear-algebra-hill-cipher
PPTX
Cryptography
PDF
Information Security Cryptography ( L02- Types Cryptography)
PDF
CRYPTOGRAPHY AND NETWORK SECURITY
PPTX
Topic1 substitution transposition-techniques
PDF
2. Stream Ciphers
PPT
Network security cryptography ppt
PPT
Symmetric and Asymmetric Encryption.ppt
Symmetric Key Algorithm
Block ciphers & public key cryptography
RSA Algorithm
Cryptography
Cryptography ppt
Cryptography.ppt
Cryptography
Cryptography
An introduction to X.509 certificates
Introduction to Cryptography
Applications of-linear-algebra-hill-cipher
Cryptography
Information Security Cryptography ( L02- Types Cryptography)
CRYPTOGRAPHY AND NETWORK SECURITY
Topic1 substitution transposition-techniques
2. Stream Ciphers
Network security cryptography ppt
Symmetric and Asymmetric Encryption.ppt
Ad

Viewers also liked (9)

PDF
sécurité informatique
PDF
Genetic Algorithm in Hill Cipher Encryption
PPTX
La sécurité informatique
DOCX
Expose sur l' informatique ok
PPTX
Cryptography
PPTX
Sécurité informatique
PPTX
Expose sur internet
PPT
Cryptography
PPT
Cipher techniques
sécurité informatique
Genetic Algorithm in Hill Cipher Encryption
La sécurité informatique
Expose sur l' informatique ok
Cryptography
Sécurité informatique
Expose sur internet
Cryptography
Cipher techniques
Ad

Similar to Cryptography (20)

PPTX
Cryptography and Network security # Lecture 4
PPTX
Chapter 3.0.pptx and image processing of security
PPT
Computer systems security 7-cryptography.ppt
PPTX
Cryptography
PPTX
Secret writing in forensic science .pptx
PPT
UNIT 2.ppt
PPTX
Secret key cryptography
PPTX
Cryptography cryptography CryptographyCryptography
PPTX
Symmetric and asymmetric key cryptography
PPTX
Symmetric Encryption Techniques
PPTX
IANSunit 1_cryptography_2.pptxv xvxvxvxv
ODP
CISSP Week 18
PDF
basic encryption and decryption
PPT
cryptography.ppt
PPTX
cryptographyandnetworksecu-module-1.pptx
PPTX
Cyber Security Part-2.pptx
PPTX
Mod1 basics cryptography first module vtu
PPTX
MODULE1_CLASSICALENCRYPTIONTECHNIQUES.pptx
PPTX
security system by desu star chapter 2 (1).pptx
PPT
Cryptography.ppt
Cryptography and Network security # Lecture 4
Chapter 3.0.pptx and image processing of security
Computer systems security 7-cryptography.ppt
Cryptography
Secret writing in forensic science .pptx
UNIT 2.ppt
Secret key cryptography
Cryptography cryptography CryptographyCryptography
Symmetric and asymmetric key cryptography
Symmetric Encryption Techniques
IANSunit 1_cryptography_2.pptxv xvxvxvxv
CISSP Week 18
basic encryption and decryption
cryptography.ppt
cryptographyandnetworksecu-module-1.pptx
Cyber Security Part-2.pptx
Mod1 basics cryptography first module vtu
MODULE1_CLASSICALENCRYPTIONTECHNIQUES.pptx
security system by desu star chapter 2 (1).pptx
Cryptography.ppt

More from Karwan Mustafa Kareem (8)

PPTX
Computer and network security
PPT
Java programming: Elementary practice
PPT
Java Programming: Loops
PPT
Java Programmin: Selections
PPT
Java programming: Elementary programming
PPT
Introduction to Java Programming Language
PPTX
MySQL Database with phpMyAdmin
PPT
Database Application with MySQL
Computer and network security
Java programming: Elementary practice
Java Programming: Loops
Java Programmin: Selections
Java programming: Elementary programming
Introduction to Java Programming Language
MySQL Database with phpMyAdmin
Database Application with MySQL

Recently uploaded (20)

PDF
Hindi spoken digit analysis for native and non-native speakers
PDF
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
PDF
Five Habits of High-Impact Board Members
PPTX
Group 1 Presentation -Planning and Decision Making .pptx
PDF
August Patch Tuesday
PPTX
Benefits of Physical activity for teenagers.pptx
PDF
STKI Israel Market Study 2025 version august
PDF
TrustArc Webinar - Click, Consent, Trust: Winning the Privacy Game
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PPTX
Web Crawler for Trend Tracking Gen Z Insights.pptx
PPTX
MicrosoftCybserSecurityReferenceArchitecture-April-2025.pptx
PDF
Getting started with AI Agents and Multi-Agent Systems
PPT
What is a Computer? Input Devices /output devices
PDF
1 - Historical Antecedents, Social Consideration.pdf
PDF
Developing a website for English-speaking practice to English as a foreign la...
PPTX
Modernising the Digital Integration Hub
DOCX
search engine optimization ppt fir known well about this
PDF
CloudStack 4.21: First Look Webinar slides
PPT
Module 1.ppt Iot fundamentals and Architecture
PDF
DP Operators-handbook-extract for the Mautical Institute
Hindi spoken digit analysis for native and non-native speakers
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
Five Habits of High-Impact Board Members
Group 1 Presentation -Planning and Decision Making .pptx
August Patch Tuesday
Benefits of Physical activity for teenagers.pptx
STKI Israel Market Study 2025 version august
TrustArc Webinar - Click, Consent, Trust: Winning the Privacy Game
Assigned Numbers - 2025 - Bluetooth® Document
Web Crawler for Trend Tracking Gen Z Insights.pptx
MicrosoftCybserSecurityReferenceArchitecture-April-2025.pptx
Getting started with AI Agents and Multi-Agent Systems
What is a Computer? Input Devices /output devices
1 - Historical Antecedents, Social Consideration.pdf
Developing a website for English-speaking practice to English as a foreign la...
Modernising the Digital Integration Hub
search engine optimization ppt fir known well about this
CloudStack 4.21: First Look Webinar slides
Module 1.ppt Iot fundamentals and Architecture
DP Operators-handbook-extract for the Mautical Institute

Cryptography

  • 1. 1 Chapter 2: Cryptography with Classical Cipher Faculty of Physical and Basic Education Computer Science By: Msc. Karwan M. Kareem 2014 - 2015 © University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
  • 2. Topics Basic concepts of Cryptography Secret writing with Cryptography Cipher Cipher Types Substitution Cipher Substitution Cipher Types 1945 1964 2  Monoalphabetic Cipher  Polyalphabetic Cipher  Polygram Cipher  Homophonic Cipher  Transposition Cipher Transposition Cipher Type  Rail Fence Cipher  Route Cipher  Simple Columnar Cipher  Keyword Columnar Cipher © University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
  • 3. Basic concepts of Cryptography  Basic Concepts ( terminology)  Plaintext : the original message.  Ciphertext : the 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 ciphertext from plaintext.  Cryptography : study of encryption principles/methods.  Cryptanalysis (code breaking) : the study of principles/ methods of deciphering ciphertext without knowing key.  Cryptology : the field of both cryptography and cryptanalysis 3 © University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
  • 4. Basic concepts of Cryptography  Cryptography  Cryptography is the science of providing security for information.  Process or Practice of the enciphering and deciphering of messages in secret code.  It has been used to obtain secure communication between individuals, government agencies, banking, and military forces.  The principles of cryptography are today applied to the encryption of FAX, TELEVISION and computer Network communications  Cryptanalysis The procedures, processes, methods, etc., used to translate or interpret secret writings (encrypted messages) into plaintext without known the secret key. 4 Cryptology: the scientific study of cryptography and cryptanalysis Cryptology  Cryptography + Cryptanalysis © University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
  • 5. Secret writing with Cryptography Polygram Cipher Affine Cipher Atbash Cipher ROT13 Cipher Caesar Cipher 5 Homophonic Cipher  NOTE: Secret Writing Cryptography (scrambled) Classical Ciphers Substitution Mono alphabetic Cipher Polyalphabetic Cipher Vigenère Cipher Beaufort Cipher Rail Fence Cipher One Time Pad Cipher  Cryptography does not hide the existence of messages.  Steganography hides even the existence of a message. Playfair Cipher Transposition Simple Columnar Cipher Keyword Columnar Ciphe © University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015 Route Cipher Modern Ciphers Steganography (hidden)
  • 6. Cipher  Cipher In Cryptography, a cipher is an algorithm for performing encryption or decryption. It can be Symmetric or Asymmetric “a way of changing a message to keep it secret”.  Symmetric (Private-key cryptography): In Symmetric Key Algorithms same key used for encryption and decryption.  Asymmetric (Public-key cryptography): In Asymmetric Key Algorithms different keys used for encryption and decryption. Stream ciphers encrypt the digits (typically bits) of a message one at a time. Block ciphers take a number of bits and encrypt them as a single unit (Block), Blocks of 64 or 128 bits have been commonly used.  There are two types of ciphers: 1. Classical Ciphers 2. Modern Ciphers 6 © University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
  • 7. Cipher Type 1. Classical Ciphers A classical cipher is a type of cipher that was used historically. In general, classical ciphers operate on an alphabet of letters (such as "A-Z"), and are implemented by hand or with simple mechanical devices. Sender and Recipient share a same key. All classical encryption & decryption algorithms are Symmetric. Classical Cipher Types: Substitution Cipher Transposition Cipher Substitution Cipher Is a method of encryption by which units of plaintext are replaced with Ciphertext, according to a regular systems. Substitution Cipher Types 1- Monoalphabetic Cipher 2- Polyalphabetic Cipher 3- Polygram Cipher. 7 4- Homophonic Cipher. © University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
  • 8. Substitution Cipher Type  Substitution Cipher Types 1.Monoalphabetic Cipher The Monoalphabetic substitution cipher is so called because each plain text letter is substituted by the same cipher text letter throughout the entire message. Example: In the cipher table below, plaintext ‘ r ’ is always replaced by cipher text ‘ H ’. 8 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 X D G S Z A N Y O B T M J C E V F H K W P L Q U R I Plain Text: Cipher Text: © University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
  • 9. Substitution Cipher Type  Substitution Cipher Types 1. Monoalphabetic Cipher Types Monoalphabetic Cipher is oldest and weakest cipher method. Monoalphabetic Cipher can be broken through the use of Frequency Analysis method. The most famous methods of this type are: A.Caesar Cipher. B.ROT13 Cipher. C.Atbash Cipher. D.Affine Cipher. 9 © University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
  • 10. Substitution Cipher Type  Substitution Cipher Types 1.Monoalphabetic Cipher Types A.Caesar Cipher Caesar Cipher is One of the simplest examples of a substitution cipher, which have been used by Julius Caesar to communicate with his army. Caesar is considered to be one of the first persons to have ever employed encryption for the sake of securing messages. “ Caesar used a shift of 3”. Encryption Method: C = P + K Key Always = 3 Decryption Method: P = C - K Key Always = 3 Example: Plain Text: ZAGROS Key = 3 Cipher Text: CDJURV 10 © University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
  • 11. Substitution Cipher Type  Substitution Cipher Types 1.Monoalphabetic Cipher Types B. ROT13 Cipher ROT13 is a simple encryption cipher. It is a variant of the Caesar Cipher.  Encryption Method: C = P + K Key Always = 13  Decryption Method: P = C - K Key Always = 13  Example: Plain Text: HELLO Key = 13 Cipher Text: URYYB 11 © University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
  • 12. Substitution Cipher Type  Substitution Cipher Types 1.Monoalphabetic Cipher Types C. Atbash Cipher Atbash is a simple substitution cipher for the Hebrew alphabet. Using this method sometimes the encrypted words has another meaning.  Encryption Method: Reversing each letter once.  Decryption Method: Reversing each letter once. An Atbash cipher for Hebrew alphabet; Plain: אבגדהוזחטיכלמנסעפצקרשת Cipher: תשרקצפעסנמלכיטחזוהדגבא An Atbash cipher for English alphabet; Plain: abcdefghijklmnopqrstuvwxyz Cipher: zyxwvutsrqponmlkjihgfedcba  Example: 12 © University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
  • 13. Substitution Cipher Type  Substitution Cipher Types 1.Monoalphabetic Cipher Types D. Affine Cipher In Affine Cipher each letter in an alphabet is mapped to its numeric equivalent as shown below;  English alphabet is 26 character therefore ( m = 26 ).  This method uses two keys “ K1 & K2 ”. We will call K1 (A) & K2 (B).  K1 can have a value from “1, 3, 5, 7, 9, 11, 13, 15, ……..……. Up to 25”  K2 can have a value from “0, 1, 2, 3, 4, 5, 6, 7, 8, 9, …………. Up to 25”  Encryption Method C = ( A * P) + B (mod m) Decryption Method P _=1 A * (C - B) (mod m) 13 © University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
  • 14.  Substitution Cipher Types 1.Monoalphabetic Cipher Types D. Affine Cipher  Example: Plaintext: KURDISTAN K1 (A) = 5 & K2 (B) = 8 Ciphertext: Encryption Method C = (A * P) + B (Mod m) C = (5 * 10) + 8 (Mod m) = 58 mod 26 = 6 = G C = (5 * 20) + 8 (Mod m) = 108 mod 26 = 4 = E C = (5 * 17) + 8 (Mod m) = 93 mod 26 = 15 = P C = (5 * 3) + 8 (Mod m) = 23 mod 26 = 23 = X C = (5 * 8) + 8 (Mod m) = 48 mod 26 = 22 = W C = (5 * 18) + 8 (Mod m) = 98 mod 26 = 20 = U C = (5 * 19) + 8 (Mod m) = 103 mod 26 = 25 = Z C = (5 * 0) + 8 (Mod m) = 8 mod 26 = 8 = I C = (5 * 13) + 8 (Mod m) = 73 mod 26 = 21 = V Substitution Cipher Type 14 © University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
  • 15. Substitution Cipher Type  Substitution Cipher Types 1.Monoalphabetic Cipher Types D. Affine Cipher  Example: Plaintext: GEPXWUZIV K1(A) = 5 & K2(B) = 8 Plaintext: _1 Decryption Method P = A * (C - B) (Mod m) P = 21 * (6 - 8) (Mod m) = -42 mod 26 = 10 = K P = 21 * (4 - 8) (Mod m) = -84 mod 26 = 20 = U P = 21 * (15 - 8) (Mod m) = 147 mod 26 = 17 = R P = 21 * (23 - 8) (Mod m) = 315 mod 26 = 3 = D P = 21 * (22 - 8) (Mod m) = 294 mod 26 = 8 = I P = 21 * (20 - 8) (Mod m) = 252 mod 26 = 18 = S P = 21 * (25 - 8) (Mod m) = 357 mod 26 = 19 = T P = 21 * (8 - 8) (Mod m) = 0 mod 26 = 0 = A P = 21 * (21 - 8) (Mod m) = 273 mod 26 = 13 = N -42 mod 26 = -16 = 26 -16 = 10 = K -84 mod 26 = - 6 = 26 - 6 = 20 = U 147 mod 26 = 17 = R 15 © University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
  • 16. Substitution Cipher Type  Substitution Cipher Types 2. Polyalphabetic Cipher Leon Battista invented the Polyalphabetic Substitution Cipher in year 1568. “Poly means Many in Greek language”. This method uses a mixed alphabet to encrypt a message. These were thought to be unbreakable for almost 300 years.  The Enigma machine is more complex but still fundamentally a polyalphabetic substitution cipher. Polyalphabetic Cipher Types A.Vigenère Cipher B.Beaufort Cipher C.One Time Pad Cipher D.Playfair Cipher 16 © University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
  • 17. Substitution Cipher Type  Substitution Cipher Types 2. Polyalphabetic Cipher Types A.Vigenère Cipher (Using Code Wheel) A tool that was used for the Vigenère Cipher was a code wheel. The outer ring of the wheel represented plaintext letters and the inner wheel represented Ciphertext letters.  Encryption Method: Go to the plaintext letter in the outer wheel and find its corresponding Ciphertext letter.  Encryption Method: Position the keyword letter under “A” but go from the inner Ciphertext wheel to the outer plaintext wheel. 17 © University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
  • 18. Substitution Cipher Type  Substitution Cipher Types 2. Polyalphabetic Cipher Types A.Vigenère Cipher (Using Code Wheel)  Example: Plain Text: KURD Key = S Cipher Text: K = C U = M R = J CMJV D = V Decrypt this; “ DGNW “ Key = S & Use Code Wheel 18 © University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
  • 19. Substitution Cipher Type  Substitution Cipher Types 2. Polyalphabetic Cipher Types A.Vigenère Cipher (Using Keyword)  Example1: Plain Text: “ on a plane the plane is due ” Key = milk Cipher Text: ? • Encode plain text. • Write key under coded plaintext, repeating as many times as necessary. • Encode key. • Add key character code to corresponding plain text code (mod 26). • Decoding of resulting integer is Ciphertext. • Note: If (Pencoding + Kencoding) >= 26 then - 26 19 © University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
  • 20.  Substitution Cipher Types 2. Polyalphabetic Cipher Types A.Vigenère Cipher (Using Keyword)  Example1: Answer +  Note: If (Pencoding + Kencoding) >= 26 then - 26 Substitution Cipher Type 20 © University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
  • 21. Substitution Cipher Type  Substitution Cipher Types 2. Polyalphabetic Cipher Types A.Vigenère Cipher (Using Keyword)  Example2: Ciphertext: “ avlzxiyofppzxiyouaoep ” Key = milk Plaintext: ? _ 0 – 12 = – 12 26 – 12 = 14 21 © University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
  • 22. Substitution Cipher Type  Substitution Cipher Types 2. Polyalphabetic Cipher Types A.Vigenère Cipher (Using Keyword) Difficulty of Vigenère cipher  The longer the keyword, the more difficult it will be for a third person to crack it.  In fact, for any plain text and any cipher text of the same length, there is a key that connects them.  Example:  consider the plain text: “ enter plain text here ”  The key connecting them (ignoring spaces) is: “ arlanptewrlahlxan ”  The cipher text will be: “ eeeee eeeee eeee eeee ” 22 © University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
  • 23. Substitution Cipher Type  Substitution Cipher Types 2. Polyalphabetic Cipher Types B. Beaufort Cipher The Beaufort cipher, created by Sir Francis Beaufort, The Beaufort cipher is a Reciprocal Cipher that is, Encryption and Decryption algorithms are the same. Encryption & Decryption Methods:  Firstly, choose the plaintext character from the top row of the tableau, call this column P.  Secondly, travel down column P to the corresponding keyLetter K.  Finally, move directly left from the Key letter to the left edge of the tableau, the Ciphertext encryption of Plaintext P with Key K will be there.  Example: Plaintext: “ HOW STUFF WORKS ’’ Key = CIPHER 23 © University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
  • 24. Substitution Cipher Type  Substitution Cipher Types 2. Polyalphabetic Cipher Types B. Beaufort Cipher Example: Answer 24 © University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
  • 25. Substitution Cipher Type  Substitution Cipher Types 2. Polyalphabetic Cipher Types C. One Time Pad Cipher known as Vernam Cipher is implemented using a random set of non repeating characters as the Key. The rest of process is same as the Vigenère cipher. Example1: Plaintext: “ HOW ARE YOU ’’ Key = NCBTZQARX Ciphertext: ?  Note: If (Pencoding + Kencoding) >= 26 then - 26 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 26 + 25 © University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
  • 26.  Substitution Cipher Types 2. Polyalphabetic Cipher Types C. One Time Pad Cipher Example2: Ciphertext: “ UQXTQUYFR ’’ Key = NCBTZQARX Plaintext: ? _ 16 – 25 = – 9 26 – 9 = 17 Substitution Cipher Type 26 © University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
  • 27. Substitution Cipher Type  Substitution Cipher Types 2. Polyalphabetic Cipher Types D. Playfair Cipher The Playfair cipher encrypts pairs of letters, instead of single letters. This is significantly harder to break. Each plaintext letter is replaced by a diagram in this cipher.  User chooses a keyword and puts it in the cells of a 5 x 5 matrix.  Letter I and J always stay in one cell .  Duplicate letters appear only once.  Number of diagrams is 26 x 26 = 676. 27 © University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
  • 28. Substitution Cipher Type  Substitution Cipher Types 2. Polyalphabetic Cipher Types D. Playfair Cipher Playfair Cipher Rules  Group plaintext letters two at a time.  Separate repeating letters with an x.  Plaintext letters in the same row are replaced by letters to the right.  Plaintext letters in the same column are replaced by letters below.  Plaintext letters in different row and column are replaced by the letter in the row corresponding to the column of the other letter and vice versa. 28 © University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
  • 29. Substitution Cipher Type  Substitution Cipher Types 2. Polyalphabetic Cipher Types D. Playfair Cipher  Example1: Plaintext: CRYPTO IS TOO EASY Key = INFOSEC Ciphertext: ?? Grouped text: CR YP TO IS TO XO EA SY Ciphertext: AQ TV YB NI YB YF CB OZ 29 © University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
  • 30. Substitution Cipher Type  Substitution Cipher Types 2. Polyalphabetic Cipher Types D. Playfair Cipher  Example2: Ciphertext: AQTVYBNIYBYFCBOZ Key = INFOSEC Plaintext: ?? Grouped text: AQ TV YB NI YB YF CB OZ Plaintext: CR YP TO IS TO XO EA SY  To Decrypt: The receiver reconstructs the 5 x 5 matrix using the keyword and then uses the same rules as for encryption. 30 © University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
  • 31. Substitution Cipher Type Substitution Cipher Types 3. Polygram Cipher This cipher technique, replaces one block of plain text with a block of cipher text, it does not work on a character by character basis. This cryptosystem make cryptanalysis harder by destroying the single character frequencies.  Example:  HELLO HELL Could be replaced by “ YUQQW TEUI ”.  CAUSE OF BECAUSE Could be replaced by “ XAYWQOA MH IGAYK ”  Despite the characters of the four blocks of text being almost the same.  Problems in PolyGram Substitution: Different keys are required for each block of characters. The encryption and decryption technique is applied to each and every block of character of a text differently: even when the block is repeated in the plain text. So it requires more time for encryption. 31 © University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
  • 32. Substitution Cipher Type  Substitution Cipher Types 4. Homophonic Cipher In this cipher technique, , plaintext letters map to more than one cipher text symbol. Usually, the highest-frequency plaintext symbols are given more equivalents than lower frequency letters. In this way, the frequency distribution is flattened, making analysis more difficult.  Since more than 26 characters will be required in the cipher text alphabet, various solutions are employed to invent larger alphabets such as a numeric substitution, uppercase, lowercase, upside down, and fanciful symbols etc.  A Mantua Homophonic Cipher (15th century, Roman Empire) is an example to this type of cipher. 32 © University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
  • 33. Substitution Cipher Type  Substitution Cipher Types 4. Homophonic Cipher  Example: Plaintext: HE EATS THEN SLEEPS AND DREAMS Ciphertext: ?? Key: The following table is the key. Ciphertext: 55QP69 11JJK 77OG?? 4987PB 99101ZS XXAZBB 58ND43 DD@AA 88 33 © University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
  • 34. Transposition Cipher  Transposition Cipher Is a method of encryption by which the positions held by units of plaintext are shifted according to a regular system. Transposition Cipher Types 1.Rail Fence Cipher. 2.Route Cipher. 3.Simple Columnar Cipher. 4.Keyword Columnar Cipher. 34 © University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
  • 35. Transposition Cipher Type  Transposition Cipher types 1.Rail Fence Cipher The Rail Fence Cipher involves writing messages so that alternate letters are written on separate upper and lower lines. The security of the cipher can be improved by choosing more than two lines to encrypt your message with.  Example1: Rail fence of depth 2  To encrypt, write the plaintext in a zigzag pattern in two rows and form the cipher text by reading off the letters from the first row followed by the second.  To decrypt, write the cipher text in two rows and read off the plaintext in a zigzag fashion. 35 © University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
  • 36. Transposition Cipher Type  Transposition Cipher types 1.Rail Fence Cipher  Example2: Rail fence of depth 3 Plain text: meet me after the toga party Row 1: m m t h g r Row 2: e t e f e t e o a a t Row 3: e a r t p y Cipher Text: MMTHGRETEFETEOAATEARTPY Decrypt this: “ IOEUDSALVKRITN “ Key: Rail fence of depth 3 Decrypt this: “ IWTKGAAAEHNSOOMKATD “ Key: Rail fence of depth 3 36 © University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
  • 37.  Transposition Cipher types 2. Route Cipher In a route cipher, the plaintext is first written out in a grid of given dimensions, then read off in a pattern given in the key.  Example1: Plain Text: meet me after the toga party at seven clock Key = 5 Rows & Row 1: m e r o r s c Row 2: e a t g t e l Row 3: e f h a y v o Row 4: t t e p a e c Row 5: m e t a t n k Cipher Text: kcolcsroremeetmetatnevetgtaftepayah (35 letters “ 35 / 5 = 7”) Transposition Cipher Type 37 © University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
  • 38. Transposition Cipher Type  Transposition Cipher types 2. Route Cipher  Example 2: Cipher Text: meetmetaxxytroreaftepagth Key = 5 Rows & Plain Text: ? 38 © University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
  • 39. Transposition Cipher Type  Transposition Cipher types 2. Route Cipher  Example 3: Cipher Text: MTETTEEFEATPHAMETAANKEYGROTVCOERSIC Key = 7 Columns & Plain Text: meet me after t?he toga party at seven clock 39 © University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
  • 40. Transposition Cipher Type  Transposition Cipher types 3. Simple Columnar Cipher This cipher technique simply arranges the plain text as a sequence of rows of a rectangle that are read in columns.  Example1: Plain Text: HELLOWORLD Key = 2 Columnar Column 1 Column 2 H E L L O W O R L D Cipher Text: HLOOL ELWRD 40 © University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
  • 41. Transposition Cipher Type  Transposition Cipher types 3. Simple Columnar Cipher  Example 2: Plain Text: HELLOWORLD Key = 3 Columnar Column 1 Column 2 Column 3 H E L L O W O R L D X X Cipher Text: HLODEORXLWLX Decrypt this; “ ICVTNTOALEHKODMERASGX “ Key = 3 Columnar 41 © University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
  • 42. Transposition Cipher Type  Transposition Cipher types 4. Keyword Columnar Cipher This cipher technique simply arranges the plain text as a sequence of rows of a rectangle that are read in columns according to the keyword.  If the keyword has six letters in it. That means that there are six columns, and each column must have the same number of letters.  The columns are ordered alphabetically according to the letters in the keyword.  Example1: Plain Text: defend the east wall of the castle Keyword = GERMAN 1st Step 2nd Step Cipher Text: nalcxehwttdttfseeleedsoaxfeahl 42 © University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
  • 43. Transposition Cipher Type Transposition Cipher types 4. Keyword Columnar Cipher  Example 2: Cipher Text: “ADDSHBGSAROLGNNVCAIISFWDIAOTRNLSAUFRLLWLOENWEHIC” Keyword = GILLIGAN Plain Text: ? 1st Step 2nd Step Plain Text: “ GILLIGANS ISLAND WAS A WONDERFUL TV SHOW FOR CHILDREN ” 43 © University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015
  • 44. END END… Any questions..? Hope you have been happy Thank you By: Msc. Karwan M. Kareem 2014 - 2015 44 © University of Sulaimani, Faculty of Physical & Basic Education, Department of Computer Science 2014 / 2015

Editor's Notes

  • #19: Answer Below: LOVE
  • #37: ANSWER: IS BELOW I LOVE KURDISTAN ROW1 FIRST 5 LETTERS… ROW2 REMAINING LETTERS 9….. ROW3 LAST 5 LETTERS…... I am awake thanks to god
  • #38: ANSWER: IS BELOW
  • #39: ANSWER: IS BELOW meet me after the toga party 23 LETTERS that why we will have to add 2 more x x R1: M E R O R R2: E A T G T R3: E F H A Y R4: T T E P x R5: M E T A x Answer: meet me after the toga party
  • #40: ANSWER: IS BELOW Answer: meet me after the toga party at seven clock
  • #41: ANSWER: IS BELOW
  • #42: ANSWER: IS BELOW IAM CLEVER THANKS TO GOD IAM ICVTNTOALEHKODMERASGx CLE VER THA NKS TOG ODx
  • #43: ANSWER: IS BELOW
  • #44: ANSWER: IS BELOW Plain text is: “ GILLIGANS ISLAND WAS A WONDERFUL TV SHOW FOR CHILDREN ”