Docsity

Security in Computing Homework Solution: Hill Cipher Encryption and DES S-boxes - Prof. Ar, Study notes of Computer Science

Toggle sidebar
bg1
CIS 3360 – Security in Computing
Spring 2016
Homework 1.4 (50 points)
Solution prepared by TA Mr. Hao Hu
11) [10] Using your knowledge of the Hill cipher. Encrypt the message “KNIGHT” using the
following encryption matrix (See the example of Hill cipher in Module 3 notes):
5
2
12
11
9
4
8
1
22
Answer: 1) Group “KNIGHT” into “KNI” and “GHT”.
2) Convert “KNI” and “GHT” into numerical equivalent, mod 26
(10
13
8) stands for “KNI”. (6
7
19) stands for “GHT”
3) Multiply the encryption key by the plaintext and reduce mod 26 to get the ciphertext
“KNI”: (5 2 12
11 9 4
8 1 22)(10
13
8)=(5∗10+2∗13+12∗8
11∗10+9∗13+4∗8
8∗10+1∗13+22∗8)=(172
259
269)=
(16
25
9) 𝑚𝑜𝑑 26. Ciphered as “QZJ”
“GHT”: (5 2 12
11 9 4
8 1 22)(6
7
19)=(5∗6+2∗7+12∗19
11∗6+9∗7+4∗19
8∗6+1∗7+22∗19)=(272
205
473)=
(12
23
5) 𝑚𝑜𝑑 26. Ciphered as “MXF”
Hence, Plaintext: “KNIGHT”. Ciphered text: “QZJMXF”.
11) [20+20] Consider the two S-boxes S1 and S2 of DES shown. Three hex digits (12 bits)
are provided to these two S boxes. The higher order six bits are fed to S1 and the lower
order six bits are fed to S2. For the six bits input to S1, the first and last bits are used to
select the row, and the middle four bits are used to select the column. Note that each S
box has four rows numbered 0, 1, 2, and 3 and sixteen columns numbered 0 to 15. So,
two bits are sufficient to select a row as 22 = 4 and four bits are sufficient to select a
column, as 24 = 16. The output from each S box is a four bit binary number, which means
that the output from each S box ranges from 0 to 15.
S1
C0
C1
C2
C3
C4
C6
C8
C9
C10
C11
C12
C13
C14
C15
pf2

Partial preview of the text

Download Security in Computing Homework Solution: Hill Cipher Encryption and DES S-boxes - Prof. Ar and more Study notes Computer Science in PDF only on Docsity!

CIS 3360 – Security in Computing

Spring 2016

Homework 1.4 (50 points)

Solution prepared by TA Mr. Hao Hu

11) [10] Using your knowledge of the Hill cipher. Encrypt the message “KNIGHT” using the

following encryption matrix (See the example of Hill cipher in Module 3 notes):

Answer: 1) Group “KNIGHT” into “KNI” and “GHT”.

2) Convert “KNI” and “GHT” into numerical equivalent, mod 26

) stands for “KNI”. (

) stands for “GHT”

3) Multiply the encryption key by the plaintext and reduce mod 26 to get the ciphertext

“KNI”: (

) 𝑚𝑜𝑑 26. Ciphered as “QZJ”

“GHT”: (

) 𝑚𝑜𝑑 26. Ciphered as “MXF”

Hence, Plaintext: “KNIGHT”. Ciphered text: “QZJMXF”.

11) [20+20] Consider the two S-boxes S1 and S2 of DES shown. Three hex digits (12 bits)

are provided to these two S boxes. The higher order six bits are fed to S1 and the lower

order six bits are fed to S2. For the six bits input to S1, the first and last bits are used to

select the row, and the middle four bits are used to select the column. Note that each S

box has four rows numbered 0, 1, 2, and 3 and sixteen columns numbered 0 to 15. So,

two bits are sufficient to select a row as 2^2 = 4 and four bits are sufficient to select a

column, as 2^4 = 16. The output from each S box is a four bit binary number, which means

that the output from each S box ranges from 0 to 15.

S1 C 0 C 1 C 2 C 3 C 4 C 5 C 6 C 7 C 8 C 9 C 10 C 11 C 12 C 13 C 14 C 15

Determine the hexadecimal output for the following two inputs:

  • R
  • R
  • R
  • R
    • S2 C 0 C 1 C 2 C 3 C 4 C 5 C 6 C 7 C 8 C 9 C 10 C 11 C 12 C 13 C 14 C
  • R
  • R
  • R
  • R - a. ABC 16 b. EF9
  • a. A 16 = 10 10 = 1010 2 B 16 = 11 10 = 1011 2 C 16 = 12 10 = Answer: (‘ | ’ stands for split into LHS and RHS)
  • ABC 16 = 1010 10 |
  • LHS: 101010 2 Row index = 10 2 = 2 10 , Column index = 0101 2 = 5 10 Value in S1: 6 10 =
  • RHS: 111100 2 Row index = 10 2 = 2 10 , Column index = 1110 2 = 14 10 Value in S2: 2 10 =
  • Output:
  • b. E 16 = 14 10 = 1110 2 F 16 = 15 10 = 1111 2 916 = 9 10 =
  • EF9 16 = 1110 11 |
  • LHS: 111011 2 Row index = 11 2 = 3 10 , Column index = 1101 2 = 13 10 Value in S1: 0 10 =
  • RHS: 111001 2 Row index = 11 2 = 3 10 , Column index = 1100 2 = 12 10 Value in S2: 0 10 =
  • Output: