QUIZ CMPE

advertisement
QUIZ CMPE-553 29.05.2007 (120 min, 2 points)
St. Name, Surname______________________________________ St.Id#_____________
Open books, notes!! Open books, notes!! Open books, notes!! Open books, notes!!
Instructor Alexander Chefranov
Task 1. (0.4 points) Calculate 153523 mod 14.
Show all intermediate steps
15 mod 14 =1 => 13523 mod 14 =1
Task 2. (0.4 points) Solve the equation
6x=5 mod 2323
Show all intermediate steps. Check your solution.
Extended Euclid(2323, 6)
A=(1,0,2323), B=(0,1,6)
Q=A3/B3=2323/6=387
T=A-QB=(1,-387, 1)
A=(0,1,6)
B=(1,-387,1)
B3=1 => B2=-387 – multiplicative inverse of 6 mod 2323.
-387mod2323=1936 mod 2323
X=(1936*5) mod 2323 = 388
Checking: 6x388=2328; 2328 mod 2323 = 5.
Task 3. (0.4 points) Calculate a value of the element (1,2) in the AES S-box (Table 5.4,
a; it is 82). Show all intermediate steps of the calculation.
12 => x 4  x
Find inverse with Extended Euclid ( x 8  x 4  x 3  x  1 , x 4  x )
A=(1,0, x 8  x 4  x 3  x  1 ), B=(0,1, x 4  x )
Q=A3/B3= x 8  x 4  x 3  x  1 / x 4  x = x 4  x  1
x 8  x 4  x 3  x  1 Dividend
x8  x5
x5  x4  x3  x  1
x5  x2
x4  x3  x2  x  1
x4  x
x 3  x 2  1 remainder
T=A-QB=(1, x 4  x  1 , x 3  x 2  1 )
A=(0,1, x 4  x )
B=(1, x 4  x  1 , x 3  x 2  1 )
Q=A3/B3= x 4  x / x 3  x 2  1 = x  1
x 4  x dividend
x4  x3  x
x3
x3  x2  1
x 2  1 remainder
x 4  x Divisor
x 4 Quotient
x
1
x 3  x 2  1 divisor
x
 1 quotient
T=A-QB=( x  1 , 1-( x  1 )( x 4  x  1 ), x 2  1 )=( x  1 ,
x 5  x 2  x  x 4  x  1  1 , x 2  1 )=( x  1 , x 5  x 4  x 2 , x 2  1 )
A=(1, x 4  x  1 , x 3  x 2  1 )
B=( x  1 , x 5  x 4  x 2 , x 2  1 )
Q=A3/B3= x 3  x 2  1 / x 2  1 = x  1
x 3  x 2  1 dividend
x 2  1 divisor
x
x3  x
 1 quotient
x2  x  1
x2  1
x remainder
T=A-QB=( 1  ( x  1)( x  1) , ( x 4  x  1 )-( x  1 )( x 5  x 4  x 2 ), x ) =
( x 2 , ( x 4  x  1 )-( x  1 )( x 4  x  1  x 6  x 5  x 3  x 5  x 4  x 2 ), x ) =
( x 2 , x6  x3  x2  x  1, x )
A=( x  1 , x 5  x 4  x 2 , x 2  1 )
B=( x 2 , x 6  x 3  x 2  x  1 , x )
Q=A3/B3= x 2  1 / x = x , remainder =1
T=A-QB = ( x 3  x  1 , ( x 5  x 4  x 2 )- x ( x 6  x 3  x 2  x  1 ),1) =
( x 3  x  1 , x 7  x 4  x 3  x 2  x  x 5  x 4  x 2 ,1) =
( x 3  x  1 , x 7  x 5  x 3  x ,1)
As far as A3=1, inverse is x 7  x 5  x 3  x
Let’s check it:
( x 7  x 5  x 3  x )( x 4  x ) = x11  x 9  x 8  x 7  x 6  x 5  x 4  x 2
x11  x 9  x 8  x 7  x 6  x 5  x 4  x 2 dividend x 8  x 4  x 3  x  1 divisor
x11  x 7  x 6  x 4  x 3
x3
x
x9  x8  x5  x3  x 2
x9  x5  x4  x2  x
x8  x 4  x3  x
x8  x 4  x3  x  1
1 remainder
 1 quotient
Hence, inverse of (12) is (1010 1010) = (AA)
Now, we are at the point to multiply:
1
1
1
1
1
0
0
0
0
1
1
1
1
1
0
0
0
0
1
1
1
1
1
0
0
0
0
1
1
1
1
1
1
0
0
0
1
1
1
1
1
1
0
0
0
1
1
1
1
1
1
0
0
0
1
1
1
1
1
1
0
0
0
1
x
0
1
0
1
0
1
0
1
+
1
1
0
0
0
1
1
0
=
0
1
0
1
0
1
0
1
+
1
1
0
0
0
1
1
0
=
1
0
0
1
0
0
1
1
Resulting vector is (1100 1001) = (C9).
Task 4. (0.4 points) Assume that p=3, q=19. Encrypt and decrypt message M=10 using
RSA
N=pq=57
 ( N )  ( p  1)( q  1)  36
E=11, d=23
Checking: ed mod 36 = 253 mod 36 = 1
Encryption: C  M e  1011 mod 57  52
Decryption: M  C d  52 23 mod 57  10
Task 5. (0.4 points) Explain RC5 CTS mode of operation: how does it manage to have a
ciphertext just the same length as the plaintext? Draw a scheme for RC5 CTS decryption,
explain it.
RC5 CTS is described by the following scheme:
All the steps here are the same as for CBC mode excepting the last two
steps. The last block may be not full, it is padded by zeroes, XORed with the
result of P(N-1) encryption, and encrypted giving C(N-1), which is used
fully. Result of P(N-1) encryption is divided into two halves: the first one, of
the size of P(N) is used as not full C(N), and the second half, denoted X in
the scheme, is not transmitted.
X value must be restored on the receiving side to decrypt P(N-1). RC5 CTS
decryption is similar to CBC decryption in all the steps, excluding the last
two: N and N-1. At first, C(N-1) is decrypted:
DK (CN 1 )  (CN  PN , X )
The second half of the result, X, together with C(N) is used to get P(N-1) as usually.
C(N) is XORed with the first half, C(N)+P(N), to get P(N).
Download