Homework 1 2015 Fall Solutions
Homework 1 2015 Fall Solutions
Homework 1-2015-Fall-Solutions
Homework 1 Solutions
Instructor: Prof. Wen-Guey Tzeng Scribe: Amir Rezapour
Pr[A1 succeeds]
= Pr[A1 (·) = M ′ ∧ M = M ′ ]
= Pr[A1 (·) = 0 ∧ M = 0] + Pr[A1 (·) = 1 ∧ M = 1]
1 1
= · p0 + · p 1
2 2
1
= · (p0 + p1 )
2
1
=
2
✷
(b) Suggest a good strategy A2 of guessing M if p0 and p1 are known.
Answer.
0.45 · p0
Pr[M = 0|C = 0] =
0.45 · p0 + 0.55 · p1
0.55 · p1
Pr[M = 1|C = 0] =
0.45 · p0 + 0.55 · p1
0.55 · p0
Pr[M = 0|C = 1] =
0.55 · p0 + 0.45 · p1
0.45 · p1
Pr[M = 1|C = 1] =
0.55 · p0 + 0.45 · p1
1-1
(a) Give the algorithm and show that its computation time is polynomial in the total
length m of a and b, where m = len(a) + len(b).
Answer.
Euclidean(a,b)
{
while (b != 0)
{
a = a mod b;
swap (a,b);
}
return a;
}
1-2
The above Euclidean function outputs gcd(a, b). It reduces the length of a and
b alternatively in the while-loop. In each iteration, a = a mod b reduces the
length of a at least one bit. The loop ends when b = 0, i.e., len(b) = 0. In the
worst case, the while-loop takes len(a) + len(b) iterations. The complexity of
computing a = a mod b is O((len(a) − len(b) + 1) ∗ len(b)), and the complexity
of swapping (a, b) is O(len(a) + len(b)). Thus, the computation time of the
Euclidean function is (len(a) + len(b)) ∗ O((len(a) − len(b) + 1) ∗ len(b) + len(a) +
len(b)) = O(m3 + m2 ) = O(m3 ), which is polynomial time of m.
✷
• Compute gcd(a, b)
# a b ⌊a/b⌋
1 X8+ X4
+ X3 + X + 1 X7 + X6
+ X5 + X3 + 1 X +1
2 X + X + X5 + X3 + 1
7 6 X5 X2 + X + 1
3 X5 X3 + 1 X2
4 X3 + 1 X2 X
5 X2 1 X2
# x y
5 0 1
4 1 X
3 X X3 + 1
2 X3 + 1 X + X + X3 + X2 + 1
5 4
1 X5 + X4 + X3 + X2 + 1 X6 + X3 + X2 + X
1-3
• |Z∗p | = 46
• 3 is a generator of Z∗p
• 4 is a generator of Fq
• Multiplication × is under modulo 47
9. Consider group Z∗19 . What are the orders of 5 and 11? Find all generators for Z∗19 .
Find subgroups of orders 2, 3, 6, 9 if they exist. Find QR19 .
Answer.
We have ord(5) = 9 and ord(11) = 3. 2, 3, 10, 13, 14, 15 are generators of Z19 ∗ . We have
subgroups F2 = h18i, F3 = h7i, h11i, F6 = h8i, h12i, F9 = h4i, h5i, h6i, h9i, h16i, h17i.
QR19 = {1, 4, 5, 6, 7, 9, 11, 16, 17} ✷
10. Use the Chinese Remainder Theorem to compute 0 ≤ x < 352 for x mod 3 = 1,
x mod 11 = 3, and x mod 16 = 13.
Answer.
• Compute x ≤ 168
x ≡ 1 ∗ 11 ∗ 16 ∗ 2 + 3 ∗ 3 ∗ 16 ∗ 3 + 13 ∗ 3 ∗ 11 ∗ 1 (mod 528)
≡ 352 + 432 + 429 (mod 528)
≡ 157 (mod 528)
1-4
11. Apply the Rabin-Miller primality test for n1 = 133 and n2 = 257.
Answer.
We test n1 = 133 and n2 = 257 for 10 rounds as follows:
1-5