Model Answer for the Lab File
Model Answer for the Lab File
pdf)
We are given a ciphertext encrypted using a simple substitution cipher. This means each
letter in the plaintext has been replaced by another letter.
Our goal is to decrypt the message by figuring out which ciphertext letters correspond to
which plaintext letters.
The most common letter in English is e, so the most frequent letter in the ciphertext likely
corresponds to e.
Letter Frequency
z 35
n 30
s 25
q 20
c 18
o 17
f 16
l 15
j 14
w 12
Letter Frequency
r 11
b 10
g 10
d 9
h 8
k 7
m 6
y 5
x 5
p 4
v 4
a 3
e 3
i 2
u 1
From this, z, n, and s are the most frequent letters. Let’s assume:
The most common word in English is "the". Let’s look for a three-letter word in the
ciphertext that could correspond to "the".
w=t
q=h
c=e
Using the assumptions above, we can start building the substitution key:
z=e
w=t
q=h
c=e
Now, let’s look for other patterns. The word "ol" appears frequently. If o is a common letter,
it might correspond to o or a. Let’s assume:
o=o
Using the substitutions we have so far, let’s decrypt parts of the message:
The word "zqdn" becomes "e_h_". If we assume d = a, then "zqdn" becomes "eha_", which
could be "that". This would mean:
z=t
d=a
z=t
w=t
q=h
c=e
o=o
l=f
d=a
Continue this process to decrypt more words and refine the key.
Step 6: Final Decrypted Message
Copy
The Playfair cipher is a digram substitution cipher that uses a 5x5 matrix based on a
keyword.
The plaintext is split into digrams (pairs of two letters), and each digram is encrypted using
the matrix.
Fill in the matrix with the keyword (removing duplicate letters) and then fill the remaining
spaces with the rest of the alphabet (excluding J, which is combined with I).
The plaintext is: "I only regret that I have but one life to give for my country".
Remove spaces and punctuation: "ionlyregretthatihavebutonelifetogiveformycountry".
io nl yg re gr et th at ih av eb ut on el if et og iv ef or my co un tr yx
Step 5: Encrypt Each Digram
Use the Playfair matrix to encrypt each digram based on the rules:
If both letters are in the same row, replace each with the letter to the right (wrapping around
if necessary).
If both letters are in the same column, replace each with the letter below it (wrapping around
if necessary).
If the letters form a rectangle, replace each with the letter in the same row but in the column
of the other letter.
OI LN GY ER RG TE KT TA KI VA