QUIZ CMPE-553 09 . 11 .20 1 0

advertisement
QUIZ CMPE-553 09.11.2010 (90 min, 3 points)
St. Name, Surname______________________________________ St.Id#_____________
You may use one A4-sized sheet of your handwritings for your help. Mobiles are not
allowed.
Instructor Alexander Chefranov
Task 1. (0.6 points) Using the key “Eastern Mediterranean”, encipher the following
plaintext: “Save our souls” with the Playfair cipher.
E
a
n
m
c
f
l
o
v
w
Plaintext: Sa ve ou rs ou ls
Ciphertext: Ts en pl et pl pe
a b
0 1
E a
s a
w a
s
d
g
p
x
t
i/j
h
q
y
R
B
K
U
z
Task 2. (0.6 points) Using the key “Eastern Mediterranean”, encipher the following
plaintext: “Save our souls” with the Viginere cipher with 27 symbols (treat blank as the
27th symbol).
c d e f g h i j k l
m n o p q r s
t
u v w x y z
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
With Viginere cipher, encryption is made by
Ci=(pi+ki)mod27
s t e r n
m e d i
t
e r r a n e a n
v e
o u r
s o u l
s
M x d e g q 11 w r b d W
Task 3. (0.6 points) Use the Hill cipher with m=2 to encrypt plaintext “Save our souls”.
Take blanks into account. Choose appropriate key matrix. Show that this matrix is
invertible.
1 2 
A
mod 27; det A  2  25 mod 27; (det A) 1  13 mod 27

3 4
18 18
A      (18 0)  ( sa )
0  0 
21 2 
A      (2 25)  (cz )
4  25
26 0 
A      (0 26)  (a )
14  26
20 0 
A      (0 20)  (au )
17  20
26 8 
A      (8 15)  (ip )
18  15
14  0 
A      (0 14)  (ao)
20 14
11 20
A      (20 24)  (uy )
18 24
1
Task 4. (0.6 points) Determine what S-boxes in a previous round of DES algorithm
affect S-box S5 in the next round. Details of a single DES round are given below. Explain
your answer.
S5 takes as inputs bits number 25-30 which according to Expansion/Permutation table are
bits number 16, 17, 18, 19, 20, 21 of the right half output of the previous round. Bit 16 (in
the position no 16) according to Permutation function (P) is bit 10 after S-box usage in
the previous round, and it is output by S3. Bit 17 is bit 2 that is output by S1. Bit 18 is bit
8 and is output by S2. Bit 19 is bit 24 and is output by S6. Bit 20 is bit 14 and is output
by S4. Bit 21 is bit 32 and is output by S8. Hence, S3, S1, S2, S6, S4, and S8 affect S5.
Task 5. (0.6 points) Find 131 mod 1024 . Use Extended Euclid algorithm. Check
correctness of your result by multiplication
Apply Extended Euclid algorithm
1. A=(1,0,1024) B=(0,1,13)
2. B3=0? No
3. B3=1? No
4. Q=floor(1024/13)=78
5. T=(1,-78,10)
6. A=(0,1,13) B=(1,-78,10)
7. B3=0?no
8. B3=1?no
9. Q=floor(13/11)=1
10. T=(-1,79,3)
11. A=(1,-78,10) B=(-1,79,3)
12. B3=0?no
13. B3=1?no
14. Q=floor(10/3)=3
15. T=(4,315,1)
16. A=(-1,79,3) B=(4,-315,1)
17. B3=0?no
18. B3=1?yes B2=-315=709mod1024 is inverse of 13, gcd(13,1024)=1
Check correctness: 709*13=9217=1mod1024
2
DETAILS OF SINGLE ROUND
The left and right halves of each 64-bit intermediate value are treated as
separate 32-bit quantities, labeled L and R. As in the classic Feistel cipher,
the overall process at each round is summarized as follows:
Li  Ri 1
Ri  Li 1  F ( Ri 1 , K i )
The round key Ki is 48 bits. The R input is 32 bits. This R input is first
expanded to 48 bits by Expansion/Permutation (E table):
Expansion/Permutation
(E
table)
32
1 2 3 4
5
4
5 6 7 8
9
8
9 10 11 12
13
12
13 14 15 16
17
16
17 18 19 20
21
20
21 22 23 24
25
24
25 26 27 28
29
28
29 30 31 32
1
3
DETAILS OF SINGLE ROUND (CONT 1)
The resulting 48 bits are XORed with Ki. This 48 bit result passes through a
substitution function that produces 32-bit output, which is permuted by
Permutation function (P):
Permutation function( P )
16 7 20 21 29 12 28 17
1 15 23 26 5 18 31 10
2 8 24 14 32 27 3 9
19 13 30 6 22 11 4 25
The role of S-boxes is illustrated in Fig. 3.9:
The substitution consists of a set of 8 S-boxes, each of which accepts 6 bits
input and produces 4 bits as output.
4
Download