Docsity

Solution Key for Homework 2 - Computer and Network Security | CMSC 414, Assignments of Computer Science

Toggle sidebar
bg1
udaya shankar Page 1 of 4 10/12/2006
CMSC 414: HW 2 Solution and Grading
___________________________________________________________
1. (text 5.1) Would it be reasonable to compute an RSA signature on a long message m
by signing m mod-n (i.e., using (m mod-n)
d
mod-n as the signature).
No. Recall that RSA restricts the message to be signed to be smaller than n.
If m is larger than n, then message m and message (m mod-n) would have the same
signature. So it would be easy to generate different messages that have the same
signature.
___________________________________________________________
2. (text 5.6) Why do MD4, MD5, and SHA-1 require padding of messages that are
already a multiple of 512-bits?
Otherwise it would be easiy to find two messages with the same hash. Let M' be any
message that is not a multiple of 512 bits. Let M be M' padded as in MD4, so M is a
multiple of 512 bits. If no padding is used for M (because it is a multiple of 512 bits) then
MD4(M) would be the same as MD4(M').
___________________________________________________________
3. (text 6.3) In RSA, is it possible for more than one d to work with a given e, p, and q?
Because d is the multiplicative inverse of e mod-(p−1)⋅(q−1), it is unique modulo
(p−1)⋅(q−1). [Recall e has a multiplicative inverse mod (p−1)⋅(q−1) iff e is relatively
prime to (p−1)⋅(q−1). So multiplying the elements of Z
(p−1)⋅(q−1)
by e results in a
permutation of Z
(p−1)⋅(q−1)
, so there is only one element in Z
(p−1)⋅(q−1)
which yields 1 when
multiplied by e.]
___________________________________________________________
4. (text 6.8) Given your RSA signature on m
1
and m
2
, how can one compute your
signature on m
1j
⋅m
2k
for any positive integers j and k.
Let s
1
be the signature of m
1
, i.e., s
1
= m
1d
mod-n.
Let s
2
be the signature of m
2
, i.e., s
2
= m
2d
mod-n.
Signature(m
1j
) = s
1j
mod-n [because (m
1j
)
d
mod-n = (m
1d
)
j
mod-n].
Signature(m
1−1
) = s
1−1
mod-n [because (m
1−1
)
d
mod-n = (m
1d
)
−1
mod-n], assuming m
1−1
exists.
Signature(m
1
⋅m
2
) = s
1
⋅s
2
mod-n [because (m
1
⋅m
2
)
d
mod-n = (m
1d
)⋅(m
2d
) mod-n].
Signature(m
1j
⋅m
2k
) = s
1j
⋅s
2k
mod-n [from above].
___________________________________________________________
pf3
pf4

Partial preview of the text

Download Solution Key for Homework 2 - Computer and Network Security | CMSC 414 and more Assignments Computer Science in PDF only on Docsity!

CMSC 414: HW 2 Solution and Grading

___________________________________________________________

  1. (text 5.1) Would it be reasonable to compute an RSA signature on a long message m by signing m mod-n (i.e., using (m mod-n)d^ mod-n as the signature).

No. Recall that RSA restricts the message to be signed to be smaller than n.

If m is larger than n, then message m and message (m mod-n) would have the same signature. So it would be easy to generate different messages that have the same signature.


  1. (text 5.6) Why do MD4, MD5, and SHA-1 require padding of messages that are already a multiple of 512-bits?

Otherwise it would be easiy to find two messages with the same hash. Let M' be any message that is not a multiple of 512 bits. Let M be M' padded as in MD4, so M is a multiple of 512 bits. If no padding is used for M (because it is a multiple of 512 bits) then MD4(M) would be the same as MD4(M').


  1. (text 6.3) In RSA, is it possible for more than one d to work with a given e, p, and q?

Because d is the multiplicative inverse of e mod-(p−1)⋅(q−1), it is unique modulo (p−1)⋅(q−1). [Recall e has a multiplicative inverse mod (p−1)⋅(q−1) iff e is relatively prime to (p−1)⋅(q−1). So multiplying the elements of Z(p−1)⋅(q−1) by e results in a permutation of Z(p−1)⋅(q−1), so there is only one element in Z(p−1)⋅(q−1) which yields 1 when multiplied by e.]


  1. (text 6.8) Given your RSA signature on m 1 and m 2 , how can one compute your signature on m 1 j⋅m 2 k^ for any positive integers j and k.

Let s 1 be the signature of m 1 , i.e., s 1 = m 1 d^ mod-n. Let s 2 be the signature of m 2 , i.e., s 2 = m 2 d^ mod-n. Signature(m 1 j) = s 1 j^ mod-n [because (m 1 j)d^ mod-n = (m 1 d)j^ mod-n]. Signature(m 1 −^1 ) = s 1 −^1 mod-n [because (m 1 −^1 )d^ mod-n = (m 1 d)−^1 mod-n], assuming m 1 −^1 exists. Signature(m 1 ⋅m 2 ) = s 1 ⋅s 2 mod-n [because (m 1 ⋅m 2 )d^ mod-n = (m 1 d)⋅(m 2 d) mod-n]. Signature(m 1 j⋅m 2 k) = s 1 j⋅s 2 k^ mod-n [from above].

___________________________________________________________

  1. Using the efficient algorithm, compute 131^25 mod-15.

25 = (11001) 2 [25 = 16 + 8 + 1] 131 (1)^ mod-15 = 11 131 (10)^ mod-15 = 11⋅11 mod-15 = 121 mod-15 = 1 131 (11)^ mod-15 = 1⋅11 mod-15 = 11 mod-15 = 11 131 (110)^ mod-15 = 11⋅11 mod-15 = 121 mod-15 = 1 131 (1100)^ mod-15 = 1⋅1 mod-15 = 1 131 (11000)^ mod-15 = 1⋅1 mod-15 = 1 131 (11001)^ mod-15 = 1⋅11 mod-15 = 11 So 131^25 mod-15 = 11


  1. (text 7.1) If m and n are two positive integers, show that m/gcd(m,n) and n/gcd(m,n) are relatively prime.

By Euclid’s algorithm, there exist integers u and v such that u⋅m + v⋅n = gcd(m,n). Dividing both sides by gcd(m,n) gives u⋅(m/gcd(m,n)) + v⋅(n/gcd(m,n)) = 1. So by Euclid algorithm, m/gcd(m,n) and n/gcd(m,n) are relatively prime (note that both are integers by definition of gcd).


  1. (text 7.10) If n = p 1 a1^ ⋅ p 2 a2^ ⋅ ⋅ ⋅ pkak^ where pi is prime, what is φ(n).

We have already established the following:

  • φ(pa) = (p-1)⋅pa−^1 for p prime and a > 0
  • φ(p⋅q) = φ(p)⋅φ(q) for p and q relatively prime

We also have that if p 1 , p 2 , ⋅⋅⋅, pn, q are distinct primes, then (p 1 a1⋅p 2 a2^ ⋅⋅⋅⋅ pnan) and qb are relatively prime.

Hence by induction φ( p 1 a1^ ⋅ p 2 a2^ ⋅ ⋅ ⋅ pkak^ ) = (p 1 −1)⋅p 1 a1−^1 ⋅ (p 2 −1)⋅p 2 a2−^1 ⋅⋅⋅ (pk−1)⋅pkak−^1

___________________________________________________________

  1. Given positive integers z 1 , z 2 , z 3 , x 1 , x 2 , x 3 , such that z 1 , z 2 , z 3 are relatively prime, obtain a formula that yields a number x in Zz1⋅z2⋅z3 such that x mod-z 1 = x 1 x mod-z 2 = x 2 x mod-z 3 = x 3

The Chinese remainder theorem shows us that there is exactly one such x and how to compute it.

Applying the CRT to z 1 and z 2 yields the following:

  • Let a and b satisfy 1 = a⋅z 1 + b⋅z 2 [a and b can be computed by Euclid(z 1 , z 2 )]
  • Let p = [ x 2 ⋅a⋅z 1 + x 1 ⋅b⋅z 2 ] mod z 1 ⋅z 2
  • Then p mod-z 1 = x 1 and p mod-z 2 = x 2

Applying the CRT to z 1 ⋅z 2 and z 3 yields the following:

  • Let c and d satisfy 1 = c⋅(z 1 ⋅z 2 ) + d⋅z 3 [c and d can be computed by Euclid(z 1 ⋅z 2 , z 3 )]
  • Let q = [ p⋅c⋅(z 1 ⋅z 2 ) + x 3 ⋅d⋅z 3 ] mod z 1 ⋅z 2 ⋅z 3
  • Then q mod-(z 1 ⋅z 2 ) = p and q mod-z 3 = x 3 Thus q is the number x we want.

In summary, x = [ p⋅c⋅(z 1 ⋅z 2 ) + x 3 ⋅d⋅z 3 ] mod z 1 ⋅z 2 ⋅z 3 where

  • p = [ x 2 ⋅a⋅z 1 + x 1 ⋅b⋅z 2 ] mod z 1 ⋅z 2
  • c and d satisfy 1 = c⋅(z 1 ⋅z 2 ) + d⋅z 3
  • a and b satisfy 1 = a⋅z 1 + b⋅z 2