0% found this document useful (0 votes)
34 views17 pages

Lec Three

The document discusses various substitution cipher techniques including the Caesar cipher, monoalphabetic ciphers, Playfair cipher, and Hill cipher. It provides examples of encrypting and decrypting text using each cipher. For the Hill cipher, it gives a key matrix of [[4,1],[3,2]] and uses this key to encrypt the plaintext "DR" to the ciphertext "HV". It then shows the process of finding the inverse key matrix and using it to decrypt "HV" back to the original plaintext "DR". [END SUMMARY]

Uploaded by

Davis Punjila
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views17 pages

Lec Three

The document discusses various substitution cipher techniques including the Caesar cipher, monoalphabetic ciphers, Playfair cipher, and Hill cipher. It provides examples of encrypting and decrypting text using each cipher. For the Hill cipher, it gives a key matrix of [[4,1],[3,2]] and uses this key to encrypt the plaintext "DR" to the ciphertext "HV". It then shows the process of finding the inverse key matrix and using it to decrypt "HV" back to the original plaintext "DR". [END SUMMARY]

Uploaded by

Davis Punjila
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 17

RUAHA CATHOLIC UNIVERSITY

FACULTY OF INFORMATION TECHNOLOGY AND


COMMUNICATION
DEPARTMENT OF COMPUTER SCIENCE

Substitution Cipher Techniques


Lecture Three
RIT 212

Dani Mfungo
Outlines

• Caesar Cipher
• Monoalphabetic Ciphers
• Playfair Cipher
• Hill Cipher
Caesar Cipher
Brute-Force Cryptanalysis
• Simply try all the 25 possible keys:
• Assumptions:
• The encryption and decryptions
algorithms are known
• There are only 25 keys to try
• The language of the plaintext is known
and easily recognizable
Brute-Force
Cryptanalysis
of
Caesar Cipher

With only 25 possible


keys Caesar Cipher is
far from secure
Monoalphabetic Cipher
• A dramatic increase in key space can be achieved
by allowing an arbitrary substitution

• If the cipher can be any permutation of the 26 alphabetic


characters, then there are 26! Or greater than 4x1026
possible keys.
• This is greater key space and would seem to eliminate
brute-force techniques for cryptanalysis
Attack of
Monoaphabetic
Cipher

Relative frequency of Letters in English Text


Example
Cipher text

Letters frequencies
obtained for comparison

Replacing in the obtained


letters
(only four letters have been
identified and replaced)

Plain text
obtained
Monoalphabetic ciphers Cont…

• Monoalphabetic ciphers reflect the frequency of letters in


a language and therefore easy to break
• A countermeasure is to apply homophones which is a
multiple substitution for a single letter in rotation or
randomly.
• If the number of symbols assigned to each letter is
proportional to its relative frequency in that language,
then single letter frequency can be obliterated
Playfair Cipher
• The best known multiple letter cipher
• Based on 5x5 matrix of letters constructed using a keyword

For example
“MONARCHY”
is a keyword
(by load peter Wimsey)

Fill in the letters in the matrix from left to right


after the keyword without repeating the letter
Playfair Encryption rules
Plaintext is encrypted two letters at a time
1. Repeating plaintext letters that are in the same pair are separated with a filler
letter, such as x, so that: { balloon is treated as ba lx lo on}

2. Two plaintext letters 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. Two plaintext letters that fall in the same column are each replaced by the
letter beneath, with the top element of the column circularly following the
last. For example, mu is encrypted as CM.

4. Otherwise, each plaintext letter in a pair 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).
Hill Cipher
• Developed by the mathematician Lester Hill
in 1929.
• It is based on modulo arithmetic and matrix
Example of Hill Cipher (ENCRYPTION)

Consider the plain text “P = DR”


The encryption Key K=
C= E(K,P) = PK mod 26
8 H 
Mod 26 = 22 = V 
   

Therefore Cipher text C = “HV”


Hill Cipher (DECRYPTION)
P=D(K,C)=CK Mod26=PKK =P
-1 -1

Steps
• Find the Determinant of K
• Use the Det K to find the K-1
Finding the K-Inverse

 4,1
(1) K   (2) det K  (4 x 2)  (3x1)  5
3,2

1
1  2, 1 
(3) K 1

det K
  mod 26 (4) 5 mod 26  21
 3, 4

1  2, 1   42,21  16,5
(5) K  21  mod 26    mod 26   
 3, 4  62, 84 15,6
Decrypting C=[HV] = [8,22]
16,5  8   238 4
(6) P  15,6 22 mod 26  252 mod 26  18
      

P  [DR ]
Assignment

(1) Revise Modulo Arithmetic with matrix


multiplications
(2) Encrypt and decrypt the word “IQ” using
Hill cipher. Use the same Key above

You might also like