YALE UNIVERSITY
DEPARTMENT OF COMPUTER SCIENCE
| CPSC 467a: Cryptography and Computer Security | Handout #12 | |
| Yinghua Wu | November 6, 2006 | |
Solutions to Problem Set 4
Problem 17: Diffie-Hellman Key Exchange

for all q > 1 such that q∣(p - 1). So here for p = 29 and g = 2, we check all the possible q = {2,4,7,14,28} as the following:

Problem 18: ElGamal Cryptosystem
According to ElGamal Protocol, Bob’s public key is (p,g,b) = (29,2,8) and private key is (p,g,y) = (29,2,3).
Problem 19: Square Roots with Composite Moduli
Z*105, then if b2 ≡ 1 (mod 105), we have 

b2 (mod n) is a 8-to-1 function, in which n = pqr for p,q,r
distinct odd primes. The brief explanation is if a
QRn, then a has two square roots Sp = {±bp}
mod p, two square roots Sq = {±bq} mod q and two square roots Sr = {±br} mod r.
Any triple combination {b1,b2,b3}, in which b1
Sp, b2
Sq and b3
Sr, uniquely
determines the number b
Z*n such that b2 ≡ a (mod n). So cu is a 8-to-1 function and
∣QR105∣ =
∣Z*105∣ = 6.
From the above description, we can know that if a
QRn, then a is also a quadratic residue modulo
p,q,r, and vice versa. So in order to find out all quadratic residues of n = 105, we need to find out
quadratic residues of p = 3,q = 5,r = 7 first. That’s QR3 = {1}, QR5 = {1,4}, and
QR7 = {1,2,4}. We solve the following set of equations by Chinese Remainder theorem:

Problem 20: Computing Square Roots Modulo a Prime
QR103, then
b ≡ 2(103+1)∕4 ≡ 226 ≡ 38 (mod 103) is a square root of 2 modulo 103.Problem 21: Quadratic Residues
You can use Legendre Symbol to directly show the result or make advantage of a prime’s primitive roots as the following:
Since p is an odd prime, there must be some primitive root of p, denoted as g. Assume a ≡ gu (mod p)
and b ≡ gv (mod p). Since a,b
QNRp, u and v must be odd integers. Then ab ≡ gu+v (mod p).
Because u + v is even, g(u+v)∕2 is exactly a square root of ab. So ab is a quadratic residue modulo p.