Answers
Answers
2. Symmetric-Key Encryption
1. If all keys are equal, then C0 = 0 . . . 0 or C0 = 1 . . . 1.
We consider for example the bits at the positions
2,3,5,7,9,11,13,15,16,18,20,22,24,26,28,1 of C0 and denote this sequence
by b1 , b2 , . . . , b16 .
Bit bi appears as bit number 5 in ki , i = 1, . . . , 16. Thus we have b1 =
b2 = . . . = b16 , because all keys are equal. Additionally we consider the
positions 3,4,6,8,10,12,14,16,17,19,21,23,25,27,1,2 of C0 . The i-th bit in
this sequence is the 24th bit of ki . Thus all bits at these positions are
equal. Position 3 appears in both cases. Thus all bits of C0 are equal.
Similar arguments show that D0 = 0 . . . 0 or D0 = 1 . . . 1.
We obtain the four weak keys by combining the possible values of C0 and
D0 . If we apply P C1 to the four rows
01 01 01 01 01 01 01 01
FE FE FE FE FE FE FE FE
1F 1F 1F 1F 0E 0E 0E 0E
E0 E0 E0 E0 F 1 F 1 F 1 F 1
we see that the four rows are the weak keys of DES. Note that P C1 is a
permutation on 56 bits. The bits in the positions 8,16,24,32,40,48,56,64
are not used.
2. a. Note that k yields ki , if k yields ki and that E(x) = E(x). Thus
f (x, k) = P (S(E(x) ⊕ k)) = P (S(E(x) ⊕ k)) = f (x, k)
and
ϕi (x, y) = (x ⊕ fi (y), y)
= (x ⊕ f (y, k i ), y)
= (x ⊕ f (y, ki ), y)
= (x ⊕ fi (y), y)
= (x ⊕ fi (y), y)
= ϕi (x, y).
2 Answers to the Exercises
Hence we get
DESk (x) = IP −1 (ϕ16 (µ(ϕ15 (. . . µ(ϕ2 (µ(ϕ1 (IP (x))))) . . .))))
= IP −1 (ϕ16 (µ(ϕ15 (. . . µ(ϕ2 (µ(ϕ1 (IP (x))))) . . .))))
..
.
= IP −1 (ϕ16 (µ(ϕ15 (. . . µ(ϕ2 (µ(ϕ1 (IP (x))))) . . .))))
= DESk (x).
b. DES(k, x) = y implies
DES(k, x) = DES(k, x) = DES(k, x) = y.
Assume c = DESk (m) and c̃ = DESk (m̃) are known.
Choose k ′ and compute y = DES(k ′ , m).
i. If y = c̃, then the key is k ′ .
ii. If y = c, then the key is k ′ .
Thus, we can test the two keys k ′ and k ′ with one encryption.
3. Let f : {0, 1}n −→ {0, 1}n be a permutation, x1 an initial value and
x1 , x2 , . . . the sequence obtained by applying f . Then there exists an i
with f (xi+1 ) ∈ {x1 , . . . , xi }. Let j be the first i with this property. Since
f is a permutation f (xi ) = x1 . Otherwise an element would have two pre-
images. (x1 , . . . , xj ) is a cycle of f . The average period of the key stream
is the average length of a cycle of a randomly selected permutation.
Let S = {0, . . . , k} and
Cm = {c | c is an cycle of length m of a permutation on S}.
A fixed cycle of length m appears in (n − m)! permutations. The number
of different cycles (x1 , . . . , xm ) is k(k−1)...(k−m+1)
m . Thus
k!
|Cm | = .
m
Let Cm,l = {c ∈ Cm | c contains l}. Totally there appear k! elements in
cycles of length m. Each element l is equally likely to appear. Thus
k!
|Cm,l | =
k
(independent of m and l). The average number of cycles of length m
containing l over all permutations is k1 . We get as average over all cycle-
lengths
∑k
m k+1
= .
m=1
k 2
For n = 2k we get an average cycle-length of 2n−1 + 21 .
3. Public-Key Cryptography
Z∗n ∼
= Z∗p × Z∗q
and
µ2 : Z∗q −→ Z∗q , x 7−→ xe
are isomorphisms if and only if gcd(e, p − 1) = 1 and gcd(e, q − 1) = 1.
This implies the assertion.
3. Let g be a primitive root in Z∗p .
i+1
Let [a] ∈/ Wn . Then there is an i, 0 ≤ i ≤ t − 1, with a2 m ≡ 1 mod n
i i
and a2 m ̸≡ ±1 mod n. Then [a2 m ] and [1] are square roots of [1], and the
⃝H.
c Delfs and H. Knebl
4 Answers to the Exercises
Wn0 is not empty, since [−1] ∈ Wn0 . Let r = max{i | Wni ̸= ∅} and
U := {a ∈ Z∗n | a2
r
m
≡ ±1 mod n}.
r r
and w2 m ≡ +1 mod q, hence w2 m ̸≡ ±1 mod n. Thus, w ̸∈ U , and we
see that U is indeed a proper subgroup of Z∗n . Thus |Wn | ≤ φ(n)
2 .
ei ≡ 1 mod ord(x).
To prevent the decryption-by-iterated-encryption attack, it is re-
quired that ord(e mod ord(x)) is large for x and e.
We show that the set of “exceptions”,
⃝H.
c Delfs and H. Knebl
6 Answers to the Exercises
y r rs = y t rs = g tz rs
( )m−tz
= g tz t(p−3)(m−tz)/2 = g tz t(p−1)/2 t−1
( )m−tz
= g tz −t−1 = g tz g m−tz = g m .
4. Cryptographic Protocols
1. With this protocol the simple man-in-the-middle attack does not work.
A more sophisticated attack is necessary. If adversary Eve selects e and
e
declares yA as her public key, a man-in-the-middle attack works:
a. Eve intercepts c and forwards it unchanged to Bob.
b. Eve intercepts d and forwards de to Alice.
Then Alice computes k = dexA yB a
= g bexA g axB . She believes that she
shares k with Bob. Whereas Bob believes that he shares k = cxB yE b
=
axB bexA
g g with Eve. Eve cannot compute the session key k. However, she
can masquerade as Alice.
2. Protocol 4.1.
OneOfTwoSquareRoots(x1 , x2 )
Case: Peggy knows a square root y1 of x1 (the other case follows
analogously):
1. Peggy chooses at random r1 , r2 ∈ Z∗n and e2 ∈ {0, 1} and
sets a = (a1 , a2 ) = (r12 , r22 xe22 ). Peggy sends a to Vic.
2. Vic chooses at random e ∈ {0, 1}. Vic sends e to Peggy.
3. Peggy computes
e1 = e ⊕ e2 ,
b = (b1 , b2 ) = (r1 y1e1 , r2 )
e = e1 ⊕ e2 ,
b21 = a1 xe11 , b22 = a2 xe22 .
will accept.
b. Let x ∈ QRn . Then a = r2 xσ ∈ QRn , for σ ∈ {0, 1}, r ∈ Z∗n . Thus
τ is always 1 and prob(σ = τ ) = 1/2. Thus a dishonest Peggy can
convince Vic with probability 1/2 if x ∈ QRn .
c. Let V ∗ be a dishonest verifier defined by the following
Protocol 4.2.
P QRn
( )
1. V ∗ chooses at random r ∈ Z∗n with nx = 1 and sends
a = r to Peggy. {
0 if a ∈ QRn
2. Peggy computes τ := and sends τ to Vic.
1 if a ∈
/ QRn
⃝H.
c Delfs and H. Knebl
8 Answers to the Exercises
3. V ∗ outputs τ .
Note τ = 0 if r ∈ QRn and τ = 1 if r ∈ / QRn . Thus V ∗ can de-
cide after interaction with Peggy, whether a randomly chosen r is a
quadratic residue. Without Peggy’s help he cannot do this accord-
ing to the quadratic residuosity assumption (see Section 4.3.1 and
Definition 6.11).
d. Algorithm 4.3.
int S (int x)
1 select r ∈ Z∗n and σ ∈ {0, 1} uniformly at random
2 return (ã, τ̃ ) ← (r2 xσ , σ)
By construction, the random variables S(x) and (P, V )(x) are iden-
tically distributed for x ∈ QNRn .
e. Vic proofs to Peggy after step 1 that he knows a square root of a or
of a/x by using the protocol of Exercise 2. He can only succeed, if he
followed the protocol in step 1. Thus he is a honest verifier and d)
applies.
4. The idea is as in Exercise 3e). The verifier proves that he follows the
protocol in step 1, i.e., that he sends a message which he encrypted with
the public key. For this purpose, he shows that he knows the e-th root of
the message he transmitted.
To show that a prover Peggy knows the e-th root x of y, the following
protocol may be used.
Protocol 4.4.
e-th root(y)
1. Peggy chooses at random r ∈ Z∗n and sets a = re . Peggy
sends a to Vic.
2. Vic chooses at random σ ∈ {0, 1}. Vic sends σ to Peggy.
3. Peggy computes b = rxσ and sends b to Vic, i.e., Peggy sends
r, if e = 0, and rx, if σ = 1.
4. Vic accepts, if and only if be = ay σ .
The completeness, soundness and zero-knowledge properties are analo-
gously proven as in Protocol 4.5.
5. a. Alice commits to 0, if c ∈ QRn and to 1, if c ∈ / QRn .
Note: c ∈ QRn ⇐⇒ −c ∈ / QRn .
b. c1 c2 = r12 r22 (−1)b1 +b2 mod 2 = (r1 r2 )2 (−1)b1 ⊕b2 .
c. c1 and c2 commit to the same value, if c1 c2 ∈ QRn . They commit
to different values, if c1 c2 ∈ / QRn . Both cases can be proven by zero-
knowledge proofs (see Section 4.2.4 and Exercise 3).
6. The access structure can be realized, if P1 gets three shares, P2 two shares
and P3 , P4 , P5 and P6 each get one share in a (5, n)-Shamir threshold
scheme.
⃝H.
c Delfs and H. Knebl
10 Answers to the Exercises
10. Voter Vj can duplicate the vote ci = (ci,1 , ci,2 ) of voter Vi . For this
purpose, he selects α and sets cj = (ci1 g α , ci2 hα ). He has to prove that
his vote is a correctly formed one, by the protocol OneOf T woP airs from
Exercise 9. We first discuss the case, where the interactive version of the
proof is applied.
a. Voter Vj can derive from voter Vi ’s proof
(a, d, b) = OneOf T woP airs(g, h, (y1 , z1 ), (y2 , z2 )),
where
y1 = ci,1 , z1 = ci,2 g, y2 = ci,1 , z2 = ci,2 g −1 ,
a = (a1 , a2 , a3 , a4 ),
d = (d1 , d2 ), b = (b1 , b2 ),
the proof
˜ b̃) = OneOf T woP airs(g, h, (ỹ1 , z̃1 ), (ỹ2 , z̃1 )),
(ã, d,
where
ỹ1 = y1 g α , z̃1 = z1 hα
ỹ2 = y2 g α , z̃2 = z2 hα
ã = a, d˜ = d,
b̃ = (b1 − d1 α, b2 − d2 α).
b. With the non-interactive proof, the attack does not work. Replac-
ing the argument (yi , zi , i = 1, 2) of the hash function will cause a
different output. Note, the hash function is assumed to be collision
resistant. To duplicate a vote, an identical copy of the ballot must
be used. However, it will be detected, if a ballot is posted twice.
11. Protocol 4.6.
BlindRSASig(m)
1. Vic randomly chooses r ∈ Z∗n , computes m = re m and sends
it to Peggy.
2. Peggy computes σ = md and sends it to Vic.
3. Vic computes σr−1 and gets the signature of m.
12. a. ry r g −s = mg k g xr g −(xr+k) = m.
b. Choose any r, s with 1 ≤ r ≤ p − 1 and 1 ≤ s < q − 1 and let
m := ry r g −s . Then (m, r, s) is a signed message. This kind of attack
is always possible, if the message can be recovered from the signature,
as in the basic Nyberg-Rueppel scheme.
c. Use a collision-resistant hash function h and hash before encrypting,
or, if you want to preserve the message recovery property, apply a
suitable bijective redundancy function R to the message to be signed
(see [MenOorVan96]).
ry r g −s = r̃αg rx g −(s̃α+β)
= mg k̃(α−1) g k̃ g β g rx g −(s̃α+β)
= mg αk̃ g β g rx g −(s̃α+β)
= mg α(k̃−s̃) g rx
= mg −αr̃x g rx
= m.
b. The protocol is blind: The transcript (ã, m̃, r̃, s̃) is transformed into
the signed message (m, r, s) by
m = m̃ã−(α−1) g −β α,
r = r̃α,
s = s̃α + β.
a = g1b1 g2b2 y c ,
⃝H.
c Delfs and H. Knebl
12 Answers to the Exercises
a = au g1v1 g2v2 y w ,
c = h(m||a), c = (c − w)u−1 .
a = g1b1 g1b2 y c ,
5. Probabilistic Algorithms
1. The desired Las Vegas algorithm works as follows:
Repeat
1. Compute y = A(x).
2. Check by D(x, y), whether y is a correct solution for input x.
3. If the check yields ’yes’, then return y and stop. Otherwise, go back
to 1.
The expected number of iterations is 1/prob(A(x) correct) (by Lemma
B.12) and hence ≤ P (|x|). The binary length of an output y is bounded by
R(|x|). Thus, the running time of D(x, y) is bounded by S(|x| + R(|x|)).
2. We define the algorithm à on input x as follows:
a. Let t(x) := P̃ (|x|)2 Q(|x|).
b. Compute A(x) t(x)-times, and obtain the results
b1 , . . . , bt(x) ∈ {0, 1}.
c. Let { ∑t(x)
i=1 bi ≥ a
1
+1 if t(x)
Ã(x) := 1
∑t(x)
0 if t(x) i=1 bi < a.
From Corollary B.17 applied to the t(x) independent computations of
A(x), we get for x ∈ L
1 ∑
t(x)
P (|x|)2 1
prob bi < a < < ,
t(x) i=1 4t(x) Q(|x|)
and for x ̸∈ L
1 ∑
t(x)
P (|x|)2 1
prob bi ≥ a < < .
t(x) i=1 4t(x) Q(|x|)
⃝H.
c Delfs and H. Knebl
14 Answers to the Exercises
For t > ln(2)P (|x|)2 (Q(|x|) + 1), we get the desired result.
φ(n)
φ(n) > |Z∗φ(n) | = φ(φ(n)) >
c log(k)
⃝H.
c Delfs and H. Knebl
16 Answers to the Exercises
∑n−2
On the other hand, |Dn | = j=2 2j 2n−j < n2n and hence
|D̃n | 1
≥ 3.
|Dn | 2n
By the factoring assumption, the pre-image of xy cannot be efficiently
computed with a non-negligible probability for (x, y) ∈ D̃n . Thus, the
probability of success of an adversary algorithm is ≤ 1 − 1/2n3 .
4. Let A1 be the algorithm that calls A and then returns the difference
(a1 −a′1 , . . . , ar −a′r ) of A’s outputs. As we already observed in the∏proof of
r e
Proposition 4.21, A1 computes a non-trivial representation 1 = j=1 gj j
∏r aj
of 1 if and only if A computes two distinct representations j=1 gj =
∏r a′j
j=1 gj of the same element in Gq .
To compute the discrete logarithm of an element y ∈ Gq with respect
to g, we use the algorithm B (see the algorithm given in the proof of
Proposition 4.21):
Algorithm 6.1.
int B (int p, q, g, y)
1 if y = 1
2 then return 0
3 else select i ∈ {1, . . . , r} and
4 uj ∈ {1, . . . , q − 1}, 1 ≤ j ≤ r, uniformly at random
5 gi ← y ui
6 gj ← g uj , 1 ≤ j ̸= i ≤ r, is chosen at random
7 (a1 , . . . , ar ) ← A(g1 , . . . , gr )
8 if ai ̸= 0 mod q (∑ )
9 then return x ← −(ai ui )−1 j̸=i a j uj mod q
10 else return 0
If A1 returns a non-trivial representation and if ai ̸= 0 (modulo q), then
∏
y −ui ai = g aj uj ,
j̸=i
u
gj ← Gq \ {1}, 1 ≤ j ≤ r)
1
·
T (|p|)
1 1
≥ · ,
P (|p|) T (|p|)
1 1
q(p̃, n) − ·
|Jk | |Primes≤2k |
( )
1 1 |Primes≤2k |
≤ · · −1
|Jk | |Primes≤2k | |Primes≤2k | − log2 (2k)
( )
22k
1 1
≈ · · 22k −2k log (2k) − 1
2k
|Jk | |Primes≤2k | 2
2k
⃝H.
c Delfs and H. Knebl
18 Answers to the Exercises
4k
Since the number of tuples (p̃, n) is of order O( 2k4 ), the polynomial close-
ness follows.
Finally, by Theorem A.70, we have for a prime p̃ (up to some constant)
1 2k 2k
|{f ∈ Primesk | p̃ divides f − 1}| ≈ ≤ ,
p̃ − 1 k 2k
hence
22k 22k
|Jk,p̃ | ≥ 2
and then 4 · |Jk,p̃ | ≥ |Jk | ≈ 2 .
4k k
u u
We see that (n ← Jk , p̃ ← Primes≤2k ) polynomially bounds
u u
(p̃ ← Primes≤2k , n ← Jk,p̃ ). This finishes the proof.
6. Let b ∈ {0, 1}. Assume that there is a positive polynomial P , such that
u 1 1
prob(Bi (x) = b : i ← K(1k ), x ← Di ) − > ,
2 P (k)
for infinitely many k. Then the constant algorithm A(i, y) that always
returns b successfully computes the hard-core bit
u
prob(A(i, fi (x)) = Bi (x) : i ← K(1k ), x ← Di )
u 1 1
= prob(Bi (x) = b : i ← K(1k ), x ← Di ) ≥ + ,
2 P (k)
a contradiction.
7. Assume there is an algorithm A with
u
prob(A(i, fi (x), Bi (x)) = 1 : i ← K(1k ), x ← Di )
u u 1
− prob(A(i, fi (x), z) = 1 : i ← K(1k ), x ← Di , z ← {0, 1}) >
P (k)
for some positive polynomial P and for k in an infinite subset K of N
(Replacing A by 1 − A, if necessary, we may omit the absolute value).
Let à be the following algorithm with inputs i ∈ I, y ∈ Ri :
u
a. Randomly choose a bit b ← {0, 1}.
b. If A(i, y, b) = 1, then return b, else return 1 − b.
Applying Lemma B.13 we get
u
prob(Ã(i, fi (x)) = Bi (x) : i ← K(1k ), x ← Di )
1 u
= + prob(Ã(i, fi (x)) = b : i ← K(1k ), x ← Di | Bi (x) = b)
2
u
− prob(Ã(i, fi (x)) = b : i ← K(1k ), x ← Di )
1 u
= + prob(A(i, fi (x), Bi (x)) = 1 : i ← K(1k ), x ← Di )
2
u u
− prob(A(i, fi (x), b) = 1 : i ← K(1k ), x ← Di , b ← {0, 1})
1 1
> + .
2 P (k)
u 1 1
prob(Ã(i, fi (x)) = Bi (x) : i ← K(1k ), x ← Di ) > +
2 P (k)
The proof now runs in the same way as the proof of Proposition 6.17. The
main difference is that we need an algorithm Sign(i) which computes the
sign of
pi qi
prob(A(i, x) = 1 : x ← Xi ) − prob(A(i, x) = 1 : x ← Xi )
with high probability if the absolute value of this difference is ≥ 1/T̃ (k)
(with T̃ a polynomial). This algorithm is constructed analogously. We use
the fact that the probabilities can be approximately computed with high
probability by a probabilistic polynomial algorithm (Proposition 6.18).
9. see [GolMic84].
⃝H.
c Delfs and H. Knebl
20 Answers to the Exercises
1.
17 ∈ QRp ,
/ QRp , 13 · 2−1 = 16
PSqrt(17) = 13 ∈
PSqrt(16) = 4 ∈ QRp
/ QRp , 2 · 2−1 = 1
PSqrt(4) = 2 ∈
PSqrt(1) = 1 ∈ QRp
Algorithm 7.2.
int A(int p, g, x)
1 d←ε
2 for c ← 0 to t − 1 do
3 if x ∈ QRp
4 then d ← d||0
5 else d ← d||1
6 x ← xg −1
7 x ← Sqrt(p, g, x)
8 return d
b. Let {u, v} = Sqrt(y). Then Lsbt−1 (Logp,g (u)) ̸= Lsbt−1 (Logp,g (v))
(the logarithms differ by p−1 2 ). Observe that you can compute these
bits by a).
Algorithm 7.3.
int A(int p, g, y)
1 {u, v} ← Sqrt(y)
2 if A1 (p, g, y) = Lsbt−1 (Logp,g (u)
3 then return u
4 else return v
A computes the principal square root of y. The assertion now follows
by Proposition 7.5.
u 1 1
prob(A1 (p, g, g x ) = Lsbt (x) : x ← Zp−1 ) ≥ + ,
2 P (k)
⃝H.
c Delfs and H. Knebl
22 Answers to the Exercises
Algorithm 7.4.
int A(int p, g, y)
1 Lj ← j least-significant bits of x
2 d ← Lj
3 for c ← j to k − 1 do
4 b ← A1 (p, g, y, Lj )
5 if Lsb(Lj ) = 1
6 then y ← yg −1
7 {u, v} ← Sqrt(p, g, y)
8 if Lsb(Logp,g (u)) = Lsb1 (Lj )
9 then y ← u
10 else y ← v
11 Lj ← b||Lsbj−1 (Lj ) . . . Lsb1 (Lj )
12 d ← b||d
13 return d
u u 1
prob(A2 (p, g, g x ) = x : (p, g) ← Ik , x ← Zp−1 ) > ,
T (k)
for infinitely many k, a contradiction to the discrete logarithm assump-
tion.
6.
t at ut at x Lsb(at x)
0 1 0 13 1
1 15 0.5 21 1
2 22 0.75 25 1
3 11 0.875 27 1
4 20 0.9375 28 0
5 10 0.46875 14 0
6 5 0.234375 7 1
15
Thus we have a = 5, u = 64 .
7.
t at ut returned bits
0 1 0 0
1 196 0 0
2 98 0 1
3 49 0.5 0
4 220 0.25 0
5 110 0.125 1
6 55 0.5625 1
7 223 0.78125 1
8 307 0.890625 1
9 349 0.9453125 0
10 370 0.47265625 1
⌊ 121 ⌋
We get a = 370, ax = 256 391 + 1 and x = a−1 ax = 196.
8. Observe that
⃝H.
c Delfs and H. Knebl
24 Answers to the Exercises
12. a. We define
Lj : Z∗n −→ {0, 1}j , x 7−→ x mod 2j .
We get the RSA-inversion by rational approximation by using the
equations
a0 = 1, u0 = 0,
−1 1
at = 2 at−1 , ut = 2 (ut−1 + Lsb(at−1 x)) .
We have
1
Lj−1 (at x) = Lj (at−1 x + Lsb (at−1 x) n) ,
2
and we compute Lj (at x) for t ≥ 0 by
Algorithm 7.6.
int A2 (int n, e, y)
1 a ← 1, u ← 0
2 guess Lstj ← Lj (a0 x)
3 for t ← 1 to k do
4 u ← 21 (u + Lsb(Lstj ))
5 a ← 2−1 a mod n
6 Lstj ← A1 (n, e, ae y mod n)2j−1 + 12 (Lstj + Lsb(at−1 x)n)
7 return a−1 ⌊un + 1⌋ mod n
b. With the notations from the proof of Theorem 7.14 we have
At,i = at + iat−1 + b = (1 + 2i)at + b,
Wt,i = ⌊ut + iut−1 + v⌋.
and if Wt,i = q (see proof of proof of Theorem 7.14) we have
At,i x = at x + iat−1 x + bx − Wt,i n.
Thus, we get
Lj (At,i x) = Lj (at x) + Lj (iat−1 x) + Lj (bx) − Lj (Wt,i n) mod 2j
and
Lsbj (At,i x)2j−1 + Lj−1 (At,i x) =
Lsbj (at x)2j−1 + Lj−1 (at x) + Lj (iat−1 x) + Lj (bx) −
Lj (Wt,i n) mod 2j , hence
Lsbj (at x)2j−1 =
Lsbj (At,i x)2j−1 + Lj−1 (At,i x) − Lj−1 (at x + Lj (iat−1 x) − Lj (bx) +
Lj (Wt,i n) mod 2j .
We use the last equation to get Lsbj (at x) by a majority decision com-
puting Lsbj (At,i x) by algorithm A1 . Observe that the other terms of
the right side of the equation are known. Lj−1 (at x) and Lj−1 (At,i x)
can be recursively computed from Lj (at−1 x) and Lj (At−1,i x):
1
Lj−1 (at x) = (Lj (at−1 x + Lsb (at−1 x) n) ,
2
Lj−1 (At,i x) = (1 + 2i)Lj−1 (at x) + Lj−1 (bx) mod 2j−1 .
Initially we have to guess Lj (a0 x) and Lj (bx). This is polynomial in
k, because j ≤ ⌊log2 (2k)⌋.
We can modify the Algorithm from Lemma 7.15 to get an algorithm
which computes Lj (at x) with probability almost 1. From Lj (at x) we
can easily derive Lsb(at x), and we can use Lsb(at x) in Algorithm
7.17 and continue as in Section 7.2.
⃝H.
c Delfs and H. Knebl
26 Answers to the Exercises
1 di,l
< prob(A(i, z) = 1 : i ← K(1k ), z ← {0, 1}m )
R(k)
di,0
− prob(A(i, z) = 1 : i ← K(1k ), z ← {0, 1}m )
∑
l−1
di,r+1
= (prob(A(i, z) = 1 : i ← K(1k ), z ← {0, 1}m )
r=0
di,r
− prob(A(i, z) = 1 : i ← K(1k ), z ← {0, 1}m )).
We have
u
prob(Ã(i, Gi (x)) = 1 : i ← K(1k ), x ← {0, 1}Q(k) )
u
− prob(Ã(i, z) = 1 : i ← K(1k ), z ← {0, 1}Q(k)+1 )
∑
l−1
di,r+1
= prob(r) · (prob(A(i, z) = 1 : i ← K(1k ), z ← {0, 1}m )
r=0
di,r
− prob(A(i, z) = 1 : i ← K(1k ), z ← {0, 1}m )))
1∑
l−1
di,r+1
= (prob(A(i, z) = 1 : i ← K(1k ), z ← {0, 1}m )
l r=0
di,r
− prob(A(i, z) = 1 : i ← K(1k ), z ← {0, 1}m )))
1
> ,
lR(k)
for the infinitely many k ∈ K. This contradicts the assumption that G is
computationally perfect.
5. The proof runs in the same way as the proof of Yao’s Theorem 8.7. An
additional input y ∈ Yi has to be added to the algorithms A and à and
the probabilities
u
prob(Ã(i, fi (x), z) = . . . : i ← K(1k ), x ← Xi , z ← . . .)
u
must also be taken over x ← Xi . The distributions pi,r are modified to
pi,r = {(fi (x), Gi,1 (x), Gi,2 (x), . . . , Gi,r (x), br+1 , . . . , bQ(k) :
u u
(br+1 , . . . , bQ(k) ) ← {0, 1}Q(k)−r , x ← Xi }.
⃝H.
c Delfs and H. Knebl
28 Answers to the Exercises
u
prob(A(i, fi (x)) = Ci (Bi,1 (x), . . . , Bi,l(k) (x)) : i ← K(1k ), x ← Di )
1 1
> + ,
2 P (k)
for k in an infinite subset K of N.
Define the algorithm Ã(i, y, z1 , . . . , zl ) as follows:
{
1 if A(i, y) = Ci (z1 , . . . , zl ),
Ã(i, y, z1 , . . . , zl ) :=
0 else
We have
u
prob(A(i, fi (x)) = Ci (z1 , . . . , zl ) : i ← K(1k ), x ← Di ,
u
(z1 , . . . , zl ) ← {0, 1}l )
u
= prob(A(i, fi (x)) = 0 : i ← K(1k ), x ← Di )
u
·prob(Ci (z1 , . . . , zl ) = 0 : (z1 , . . . , zl ) ← {0, 1}l )
u
+ prob(A(i, fi (x)) = 1 : i ← K(1k ), x ← Di )
u
·prob(Ci (z1 , . . . , zl ) = 1 : (z1 , . . . , zl ) ← {0, 1}l )
u 1
= prob(A(i, fi (x)) = 0 : i ← K(1k ), x ← Di ) ·
2
u 1
+ prob(A(i, fi (x)) = 1 : i ← K(1 ), x ← Di ) ·
k
2
1
= .
2
Hence
u u
| prob(Ã(i, fi (x), z1 , . . . , zl ) = 1 : i ← K(1k ), x ← Di , (z1 , . . . , zl ) ← {0, 1}l )
u
− prob(Ã(i, fi (x), Bi,1 (x), . . . , Bi,l (x)) = 1 : i ← K(1k ), x ← Di ) |
1 u
= − prob(A(i, fi (x)) = Ci (Bi,1 (x), . . . , Bi,l (x))) : i ← K(1k ), x ← Di )
2
1 1 1
> + −
2 P (k) 2
1
> ,
P (k)
for infinitely many k. This is a contradiction.
7. Assume that the bits Bi,1 , . . . , Bi,l are not simultaneously secure. From
the stronger version of Yao’s Theorem, Exercise 5, we conclude that there
is a probabilistic polynomial algorithm A, a positive polynomial P and
a jk , 1 ≤ jk ≤ l(k), such that
u
prob(A(i, fi (x), Bi,1 (x) . . . Bi,jk −1 (x)) = Bi,jk (x) : i ← K(1k ), x ← Xi )
1 1
> + ,
2 P (k)
for infinitely many k. This is a contradiction.
8. The statement, which is analogous to Theorem 8.4, is almost identical to
the statement of Theorem 8.4:
For every probabilistic polynomial algorithm A with inputs i ∈ Ik , z ∈
{0, 1}l(k)Q(k) , y ∈ Di and output in {0, 1} and every positive polynomial
P ∈ Z[X], there is a k0 ∈ N, such that for all k ≥ k0
u u
| prob(A(i, z, y) = 1 : i ← K(1k ), z ← {0, 1}l(k)Q(k) , y ← Di )
Q(k) u 1
− prob(A(i, Gi (x), fi (x)) = 1 : i ← K(1k ), x ← Di ) | ≤ .
P (k)
The proof runs as the proof of Theorem 8.4. There are only the following
differences:
In the distributions pi,r , the elements bi have to be chosen from {0, 1}l(k) :
u
bi ← {0, 1}l(k) , and Xi has to be set as Xi := {0, 1}l(k)Q(k) × Di .
We define the algorithm à as follows:
On inputs i ∈ Ik , y ∈ Di , w ∈ {0, 1}l(k)
a. Randomly choose r, with 0 ≤ r < Q(k).
b. Randomly choose b1 , b2 , . . . , bQ(k)−r−1 in {0, 1}l(k) .
c. For y = fi (x) let Ã(i, y, w) :=
A(i, b1 , . . . , bQ(k)−r−1 , w, Bi (fi (x)), Bi (fi2 (x)), . . . , Bi (fir (x)), fir+1 (x)).
Then
u
| prob(Ã(i, fi (x), Bi (x)) = 1 : i ← K(1k ), x ← Di )
u u
− Ã(i, y, w) = 1 : i ← K(1k ), y ← Di , w ← {0, 1}l(k) ) |
∑
Q(k)−1
pi,r+1
= prob(r) · (prob(A(i, z, y) = 1 : i ← K(1k ), (z, y) ← Xi )
r=0
pi,r
− prob(A(i, z, y) = 1 : i ← K(1k ), (z, y) ← Xi ))
1 ∑
Q(k)−1
pi,r+1
= (prob(A(i, z, y) = 1 : i ← K(1k ), (z, y) ← Xi )
l(k) r=0
pi,r
− prob(A(i, z, y) = 1 : i ← K(1k ), (z, y) ← Xi ))
1
> ,
l(k)P (k)
for infinitely many k. This contradicts the fact that B is an l-bit hard-core
predicate.
⃝H.
c Delfs and H. Knebl
30 Answers to the Exercises
Here, observe that there are only polynomially many, namely < 4k 2 ,
message pairs {m0 , m1 }, so we can omit the sampling algorithm S (all
message pairs can be considered in polynomial time).
Let Q be a positive polynomial with deg(Q) > deg(P ) + 1. Replacing A
by a modification, if necessary, we may assume that the probability of
u u
those (n, e) ← Ik , m0 , m1 ← {0, 1}r , such that either
⃝H.
c Delfs and H. Knebl
32 Answers to the Exercises
Then
u u
prob(Ã(n, e, RSAn,e (z), z) = 1 : (n, e) ← Ik , z ← {0, 1}r )
u u u
− prob(Ã(n, e, y, z) = 1 : (n, e) ← Ik , y ← Zn , z ← {0, 1}r )
u u
≈ prob(A(n, e, z, m1 , y) = z : (n, e) ← Ik , z ← {0, 1}r ,
u
m1 ← {0, 1}r \ {z}, y ← RSAn,e (z))
u u
− prob(A(n, e, z, m1 , y) = z : (n, e) ← Ik , z ← {0, 1}r ,
u
m1 ← {0, 1}r \ {z}, y ← RSAn,e (m1 ))
1 1 1
> ≥ 2 ,
22r 2P (k) 8k P (k)
for some positive polynomial P and infinitely many k (see Exercise 4).
For m0 , m1 ∈ {0, 1}n and 0 ≤ r ≤ n, we denote by sr (m0 , m1 ) the
concatenation of the first n − r bits of m0 with the last r bits of m1 .
Thus, s0 (m0 , m1 ) = m0 and sn (m0 , m1 ) = m1 . We denote by mj,l the
l-th bit of mj . Then sr (m0 , m1 ) = m0,1 m0,2 . . . m0,n−r m1,n−r+1 . . . m1,n .
For 0 ≤ r ≤ n, let
u
pr := prob(A(i, m0 , m1 , c) = m1 : i ← k(1k ),
{m0 , m1 } ← S(i), c ← E(i, sr (m0 , m1 ))).
and
pr,m0,l =m1,l
:= prob(A(i, m0 , m1 , c) = m1 |m0,l = m1,l :
u
i ← k(1k ), {m0 , m1 } ← S(i), c ← E(i, sr (m0 , m1 ))).
1
prob(m0,l ̸= m1,l ) · (pr+1,m0,l ̸=m1,l − pr,m0,l ̸=m1,l ) > .
nP (k)
We can approximately compute the probabilities pr by a probabilistic
polynomial algorithm, with high probability (Proposition 6.18). We con-
clude that for a given positive polynomial T , there is a probabilistic
polynomial algorithm that on input 1k computes an r with pr+1 − pr >
1/nP (k), with probability ≥ 1 − 1/T (k).
Now, we give an algorithm Ã(i, y) which successfully computes the pred-
icate B. In a preprocessing phase, Ã computes an r with pr+1 − pr >
1/nP (k) (with probability ≥ 1 − 1/T (k)). Ã then uses this r for all in-
puts (i, y) with i ∈ Ik . Let l := n − r − 1. Note that sr (m0 , m1 ) and
sr+1 (m0 , m1 ) differ only in the l-th bit. On input (i, y), Ã works as fol-
lows:
a. Compute {m0 , m1 } ← S(i).
u
b. If m0,l = m1,l , then return a random b ← {0, 1} and stop.
⃝H.
c Delfs and H. Knebl
34 Answers to the Exercises
1
= prob(m0,l = m1,l ) ·
2
+ prob(m0,l ̸ m1,l ) · prob(Ã(i, fi (x)) = Bi (x)| m0,l ̸= m1,l )
=
=: (1),
u u
where the probabilities are taken over i ← k(1k ), x ← Di and the coin
tosses. This will be the desired contradiction to the fact that B is a
hard-core predicate. The following probabilities are computed under the
assumption that m0,l ̸= m1,l (we omit the assumption in our notation).
prob(Ã(i, fi (x)) = Bi (x)))
= prob(Bi (x) = m0,l ) · prob(Ã(i, fi (x)) = m0,l |Bi (x) = m0,l ))
+ prob(Bi (x) = m1,l ) · prob(Ã(i, fi (x)) = m1,l |Bi (x) = m1,l ))
1 1
= q1 + · q2 + ε
2 2
=: (2)
with
u
q1 := prob(A(i, m0 , m1 , c) = m0 : i ← k(1k ),
{m0 , m1 } ← S(i), c ← E(i, sr (m0 , m1 )))
u
= 1 − prob(A(i, m0 , m1 , c) = m1 : i ← k(1k ),
{m0 , m1 } ← S(i), c ← E(i, sr (m0 , m1 )))
= 1 − pr,m0,l ̸=m1,l ,
u
q2 := prob(A(i, m0 , m1 , c) = m1 : i ← k(1k ),
{m0 , m1 } ← S(i), c ← E(i, sr+1 (m0 , m1 )))
= pr+1,m0,l ̸=m1,l
and a negligibly small ε, i.e., given a positive polynomial U , ε ≤ 1/U (k)
for sufficiently large k (see Exercise 7 in Chapter 6).
Thus
1
(2) = + pr+1,m0,l ̸=m1,l − pr,m0,l ̸=m1,l + ε.
2
We insert (2) in (1) and get
1
(1) = + prob(m0,l ̸= m1,l ) · (pr+1,m0,l ̸=m1,l − pr,m0,l ̸=m1,l + ε)
2
1 1 1
> + (1 − )· +ε
2 T (k) nP (k)
1 1 1 1
> + = + ,
2 2nP (k) 2 2Q(k)P (k)
for infinitely many k.
The proof is finished.
b) Let x0 , x1 , z0 , z1 ∈ F2l , x0 =
̸ x1 and y0 , y1 ∈ F2f . The equation
( )( ) ( )
x0 1 a0 z0
=
x1 1 a1 z1
has exactly one solution, since x0 ̸= x1 and hence, the matrix is invertible.
Thus
|{(a0 , a1 ) | ha0 ,a1 (x0 ) = y0 , ha0 ,a1 (x1 ) = y1 }| = 2l−f 2l−f and
prob(ha0 ,a1 (x0 ) = y0 , ha0 ,a1 (x1 ) = y1 : a0 ← F2l , a1 ← F2l ) = 2−f · 2−f
u u
1
= .
|F2f |2
⃝H.
c Delfs and H. Knebl
36 Answers to the Exercises
⃝H.
c Delfs and H. Knebl
38 Answers to the Exercises
⃝H.
c Delfs and H. Knebl
40 Answers to the Exercises