0% found this document useful (0 votes)
49 views4 pages

Answer-Exercise 2

The document provides examples of encrypting messages using different ciphers. It encrypts the message "the house is being sold tonight" using a Vigenere cipher with the key "dollars" and gets the ciphertext "wvpsolkwdmezfjgzwdkgqwrst". It also encrypts the message using a Rail Fence cipher with 3 rails, getting the ciphertext "teuibnoihosesengsldtngtthibeslh". Finally, it encrypts the message "King khalid university" using a row transposition cipher with key 35214, getting the ciphertext "nlitKrhuyisndiaeguevkyi".

Uploaded by

Hakim Al-Huribi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
49 views4 pages

Answer-Exercise 2

The document provides examples of encrypting messages using different ciphers. It encrypts the message "the house is being sold tonight" using a Vigenere cipher with the key "dollars" and gets the ciphertext "wvpsolkwdmezfjgzwdkgqwrst". It also encrypts the message using a Rail Fence cipher with 3 rails, getting the ciphertext "teuibnoihosesengsldtngtthibeslh". Finally, it encrypts the message "King khalid university" using a row transposition cipher with key 35214, getting the ciphertext "nlitKrhuyisndiaeguevkyi".

Uploaded by

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

Question 1

Encrypt the message “the house is being sold tonight” using the following
ciphers. Ignore the space between words.
a. Vigenere cipher with key: "dollars"
b. Rail Fence cipher

a. Vigenere cipher with key: "dollars"


0 1 2 3 4 10 6 7 8 9 10 11 12
A B C D E F G H I J K L M
13 14 15 16 17 18 19 20 21 22 23 24 25
N O P Q R S T U V W X Y Z
Solution
Key : "dollarsdollarsdollarsdollarsdollars"
Message : "thehouseisbeingsoldtonightthehouse"
Ciphertext : "wvpsolkwdmezfjgzwdkgqwrst"

K as number Values = 3-14-11-11-0-17-18-3-14-11-11-0-17-18-3-14-11-11-0-17-18-3-14-11-


11-0-17
P as Number values = 19-7-4-7-14-20-18-4-8-18-1-4-8-13-6-18-14-11-03-19-14-13-8-6-7-19

Steps :
1. "t" becomes "w":
 C= (19+03) mod 26
 C = 22
2. "h" becomes "v":
 C= (07+14) mod 26
 C= 21
3. "e" becomes "p":
 C= (04+11) mod 26
 C = 15
4. "h" becomes "s":
 C= (4+11) mod 26
 C = 18
5. "o" becomes "o":
 C= (14+00) mod 26
 C = 14

6. "u" becomes "l":
 C= (20+17) mod 26
 C = 11
7. "s" becomes "k":
 C= (18+18) mod 26
 C = 10
8. "e" becomes "h":
 C= (4+3) mod 26
 C=7
9. "i" becomes "w":
 C= (8+14) mod 26
 C = 22

10. "s" becomes "d":


 C= (18+11) mod 26
 C=3
11. "b" becomes "m":
 C= (1+11) mod 26
 C = 12
12. "e" becomes "e":
 C= (4+0) mod 26
 C=4
13. "i" becomes "z":
 C= (8+17) mod 26
 C = 25
14. "n" becomes "f":
 C= (13+18) mod 26
 C=5
15. "g" becomes "j":
 C= (6+03) mod 26
 C=9
16. "s" becomes "g ":
 C= (18+14) mod 26
 C=6
 C=
17. "o" becomes "z":
 C= (14+11) mod 26
 C = 25
18. "l" becomes "w":
 C= (11+11) mod 26
 C = 22
19. " d" becomes "d":
 C= (03+00) mod 26
 C = 03
20. "t" becomes k":
 C= (19+17) mod 26
 C = 10
21. "o" becomes "g":
 C= (14+18) mod 26
 C=6
22. "n" becomes "q":
 C= (13+03) mod 26
 C = 16
23. "i" becomes "w":
 C= (08+14) mod 26
 C = 22
24. "g" becomes "r":
 C= (06+11) mod 26
 C = 17
25. "h" becomes "s":
 C= (07+11) mod 26
 C = 18
26. t" becomes "t" :
 C= (19+00) mod 26
 C = 19
Therefor The encrypted message with 10 Key is : "wvpsolkwdmezfjgzwdkgqwrst".

b. Rail Fence cipher


Step 1: Remove spaces from the message.
 thehouseisbeingsoldtonight
To encrypt the message "thehouseisbeingsoldtonight" using the Rail Fence
cipher, we need to choose a number of rails (levels) to create the cipher.
we choose 3 rails, the message would be written as follows:

t...e...u...i...b...n...o...i...
.h.o.s.e.s.e.n.g.s.l.d.t.n.g.t..
..t...h...i...b...e...s...l...h.
Reading off each level, the encrypted message would be:
"teuibnoihosesengsldtngtthibeslh"
Question 2
Encrypt the message “King khalid university ” using Row Transposition Ciphers if the
key=35214

1. Write the message in rows of length equal to the key length (in this case, 5).
2. Number the columns according to the key.
3. Read off the columns in the order given by the key.
Let's encrypt your message:

35214
---------
Kingk
halid
unive
rsity
 Now, we rearrange the columns in the order of the key:
21435
---------
nKkig
lhdai
iuenv
trysi

 Reading off the columns in the new order, the encrypted message is:
 "nlitKrhuyisndiaeguevkyi"

You might also like