Post · 7 min read· pp. 653–656

CS276 Lecture 28: the CZK 3-Coloring Protocol

Summary

Today we define the notion of computational zero knowledge and show that the simulator we described in the last lecture establishes the computational zero knowledge property of the 3-coloring protocol.

1. The Protocol and the Simulator

Recall that we use a commitment scheme (C,O){(C,O)} for messages in {1,2,3}{\{1,2,3\}}, and that the common input to the prover and the verifier is a graph G=([n],E){G=([n],E)}, where [n]:={1,2,…,n}{[n]:= \{1,2,\ldots,n\}}. The prover, in addition, is given a valid 3-coloring α:[n]→{1,2,3}{\alpha : [n] \rightarrow \{1,2,3\}} of G{G}.

The protocol is defined as follows:

  • The prover picks a random permutation π:{1,2,3}→{1,2,3}{\pi: \{1,2,3\} \rightarrow \{1,2,3\}} of the set of colors, and defines the 3-coloring β(v):=π(α(v)){\beta(v) := \pi(\alpha(v))}. The prover picks n{n} keys K1,…,Kn{K_1,\ldots,K_n} for (C,O){(C,O)}, constructs the commitments cv:=C(Kv,β(v)){c_v := C(K_v,\beta(v))} and sends (c1,…,cn){(c_1,\ldots,c_n)} to the verifier;
  • The verifier picks an edge (u,v)∈E{(u,v) \in E} uniformly at random, and sends (u,v){(u,v)} to the prover;
  • The prover sends back the keys Ku,Kv{K_u,K_v};
  • If O(Ku,cu){O(K_u,c_u)} and O(Kv,cv){O(K_v,c_v)} are the same color, or if at least one of them is equal to FAIL{FAIL}, then the verifier rejects, otherwise it accepts

For every verifier algorithm V∗{V^*}, we defined a simulator algorithm S∗{S^*} which repeats the following procedure until the output is different from FAIL{FAIL}:

Algorithm S1round∗{S_{1round}^*}

  • Input: graph G=([n],E){G=([n],E)}
  • Pick random coloring γ:[n]→{1,2,3}{\gamma : [n] \rightarrow \{1,2,3\}}.
  • Pick n{n} random keys K1,…,Kn{K_1,\ldots,K_n}
  • Define the commitments ci:=C(Ki,γ(i)){c_i := C(K_i, \gamma(i))}
  • Let (u,v){(u,v)} be the 2nd-round output of V∗{V^*} given G{G} as input and c1,…,cn{c_1,\ldots,c_n} as first-round message
  • If γ(u)=γ(v){\gamma(u) = \gamma(v)}, then output FAIL
  • Else output ((c1,…,cn),(u,v),(Ku,Kv)){((c_1,\ldots,c_n),(u,v),(K_u,K_v))}

We want to show that this simulator construction establishes the computational zero knowledge property of the protocol, assuming that (C,O){(C,O)} is secure. We give the definition of computational zero knowledge below.

Definition 1 (Computational Zero Knowledge) We say that a protocol (P,V){(P,V)} for 3-coloring is (t,ϵ){(t,\epsilon)} computational zero knowledge with simulator overhead so(⋅){so(\cdot)} if for every verifier algorithm V∗{V^*} of complexity ≤t{\leq t} there is a simulator S∗{S^*} of complexity ≤so(t){\leq so(t)} on average such that for every algorithm D{D} of complexity ≤t{\leq t}, every graph G{G} and every valid 3-coloring α{\alpha} we have

∣P[D(P(G,α)↔V∗(G))=1]−P[D(S∗(G))=1]∣≤ϵ\displaystyle | \mathop{\mathbb P} [ D(P(G,\alpha) \leftrightarrow V^*(G)) =1] - \mathop{\mathbb P} [ D(S^*(G)) =1] | \leq \epsilon

Theorem 2 Suppose that (C,O){(C,O)} is (2t+O(nr),ϵ/(4⋅∣E∣⋅n)){(2t+O(nr),\epsilon/(4\cdot |E|\cdot n))}-secure and that C{C} is computable in time ≤r{\leq r}.

Then the protocol defined above is (t,ϵ){(t,\epsilon)} computational zero knowledge with simulator overhead at most 1.6⋅t+O(nr){1.6 \cdot t+O(nr)}.

2. Proving that the Simulation is Indistinguishable

In this section we prove Theorem 2.

Suppose that the Theorem is false. Then there is a graph G{G}, a 3-coloring α{\alpha}, a verifier algorithm V∗{V^*} of complexity ≤t{\leq t}, and a distinguishing algorithm D{D} also of complexity ≤t{\leq t} such that

∣P[D(P(G,α)↔V∗(G))=1−P[D(S∗(G))=1]∣≥ϵ\displaystyle | \mathop{\mathbb P} [ D(P(G,\alpha) \leftrightarrow V^*(G)) =1 - \mathop{\mathbb P} [ D(S^*(G))=1] | \geq \epsilon

Let 2Ru,v{2R_{u,v}} be the event that the edge (u,v){(u,v)} is selected in the second round; then

ϵ≤∣P[D(P(G,α)↔V∗(G))=1]−P[D(S∗(G))=1]∣=∣∑(u,v)∈EP[D(P(G,α)↔V∗(G))=1∧2Ru,v]−∑(u,v)∈EP[D(S∗(G))=1∧2Ru,v]∣≤∑(u,v)∈E∣P[D(P(G,α)↔V∗(G))=1∧2Ru,v]−P[D(S∗(G))=1∧2Ru,v]∣\displaystyle \begin{array}{rcl} \epsilon &\leq & | \mathop{\mathbb P} [ D(P(G,\alpha) \leftrightarrow V^*(G)) =1 ] - \mathop{\mathbb P} [ D(S^*(G))=1] | \\ & = & \left| \sum_{(u,v) \in E} \mathop{\mathbb P} [ D(P(G,\alpha) \leftrightarrow V^*(G)) =1 \wedge 2R_{u,v} ]\right. \\ && - \left. \sum_{(u,v) \in E} \mathop{\mathbb P} [ D(S^*(G))=1 \wedge 2R_{u,v} ] \right| \\ & \leq & \sum_{(u,v) \in E} | \mathop{\mathbb P} [ D(P(G,\alpha) \leftrightarrow V^*(G)) =1 \wedge 2R_{u,v} ]\\ && - \mathop{\mathbb P} [ D(S^*(G))=1 \wedge 2R_{u,v} ] | \end{array}

So there must exist an edge (u∗,v∗)∈E{(u^*,v^*)\in E} such that

∣P[D(P↔V∗)=1∧2Ru∗,v∗]−P[D(S∗)=1∧2Ru∗,v∗]∣≥ϵ∣E∣     (1)\displaystyle | \mathop{\mathbb P} [ D(P \leftrightarrow V^*) =1 \wedge 2R_{u^*,v^*} ] - \mathop{\mathbb P} [ D(S^*)=1 \wedge 2R_{u^*,v^*} ] | \geq \frac \epsilon {|E|} \ \ \ \ \ (1)

(We have omitted references to G,α{G,\alpha}, which are fixed for the rest of this section.)

Now we show that there is an algorithm A{A} of complexity 2t+O(nr){2t + O(nr)} that is able to distinguish between the following two distributions over commitments to 3n{3n} colors:

  • Distribution (1) commitments to the 3n{3n} colors 1,2,3,1,2,3,…,1,2,3{1,2,3,1,2,3,\ldots,1,2,3};
  • Distribution (2) commitments to 3n{3n} random colors

Algorithm A{A}:

  • Input: 3n commitments da,i{d_{a,i}} where a∈{1,2,3}{a\in \{1,2,3\}} and i∈{1,…,n}{i\in \{1,\ldots,n\}};
  • Pick a random permutation π:{1,2,3}→{1,2,3}{\pi: \{1,2,3\} \rightarrow \{1,2,3\}}
  • Pick random keys Ku∗{K_{u^*}}, Kv∗{K_{v^*}}
  • Construct the sequence of commitments c1,…,cn{c_1,\ldots,c_n} by setting:
    • cu∗:=C(Ku∗,π(α(u∗)){c_{u^*} := C(K_{u^*} , \pi(\alpha(u^*))}
    • cv∗:=C(Kv∗,π(α(v∗)){c_{v^*} := C(K_{v^*} , \pi(\alpha(v^*))}
    • for every w∈[n]−{u∗,v∗}{w\in [n] - \{u^*,v^*\}}, cw:=dπ(α(w)),w{c_w := d_{\pi(\alpha(w)),w}}
  • If the 2nd round output of V∗{V^*} given G{G} and c1,…,cn{c_1,\ldots,c_n} is different from (u∗,v∗){(u^*,v^*)} output 0
  • Else output D((c1,…,cn),(u∗,v∗),(Ku∗,Kv∗)){D((c_1,\ldots,c_n),(u^*,v^*),(K_{u^*},K_{v^*}))}

First, we claim that

P[A(\mboxDistribution1)=1]=P[D(P↔V∗)=1∧2Ru∗,v∗]     (2)\displaystyle \mathop{\mathbb P} [ A( \mbox{Distribution 1} ) = 1 ] = \mathop{\mathbb P} [ D(P \leftrightarrow V^*) =1 \wedge 2R_{u^*,v^*} ] \ \ \ \ \ (2)

This follows by observing that A{A} on input Distribution (1) behaves exactly like the prover given the coloring α{\alpha}, and that A{A} accepts if and only if the event 2Ru∗,v∗{2R_{u^*,v^*}} happens and D{D} accepts the resulting transcript.

Next, we claim that

∣P[A(\mboxDistribution2)=1]−P[D(S∗)=1∧2Ru∗,v∗]∣≤ϵ2∣E∣     (3)\displaystyle | \mathop{\mathbb P} [ A( \mbox{Distribution 2} ) = 1 ] - \mathop{\mathbb P} [ D(S^*)=1 \wedge 2R_{u^*,v^*} ] | \leq \frac \epsilon {2|E|} \ \ \ \ \ (3)

To prove this second claim, we introduce, for a coloring γ{\gamma}, the quantity DA(γ){DA(\gamma)}, defined as the probability that the following probabilistic process outputs 1:

  • Pick random keys K1,…,Kn{K_1,\ldots,K_n}

  • Define commitments cu:=C(Ku,γ(u)){c_u:= C(K_u,\gamma(u))}

  • Let (u,v){(u,v)} be the 2nd round output of V∗{V^*} given the input graph G{G} and first round message c1,…,cn{c_1,\ldots,c_n}

  • Output 1 iff (u,v)=(u∗,v∗){(u,v) = (u^*,v^*)}, γ(u∗)≠γ(v∗){\gamma(u^*) \neq \gamma(v^*)}, and

    D((c1,…,cn),(u∗,v∗),(Ku∗,Kv∗))=1\displaystyle D((c_1,\ldots,c_n),(u^*,v^*),(K_{u^*}, K_{v^*})) = 1

Then we have

P[A(\mboxDistribution2)=1]=∑γ:γ(u∗)≠γ(v∗)32⋅13n⋅DA(γ)     (4)\displaystyle \mathop{\mathbb P} [ A( \mbox{Distribution 2} ) = 1 ] = \sum_{\gamma: \gamma(u^*) \neq \gamma(v^*)} \frac 32 \cdot \frac 1 {3^n} \cdot DA(\gamma) \ \ \ \ \ (4)

Because A{A}, on input Distribution 2, first prepares commitments to a coloring chosen uniformly at random among all 1/(6⋅3n−2){1/(6 \cdot 3^{n-2})} colorings such that γ(u∗)≠γ(v∗){\gamma(u^*) \neq \gamma(v^*)} and then outputs 1 if and only if, given such commitments as first message, V∗{V^*} replies with (u∗,v∗){(u^*,v^*)} and the resulting transcript is accepted by D{D}.

We also have

P[D(S∗)=1∧2Ru∗,v∗]\displaystyle \mathop{\mathbb P} [ D(S^*)=1 \wedge 2R_{u^*,v^*} ]

=1P[S1Round∗≠FAIL]⋅∑γ:γ(u∗)≠γ(v∗)13n⋅DA(γ)     (5)\displaystyle = \frac {1}{\mathop{\mathbb P} [ S^*_{1Round} \neq FAIL]} \cdot \sum_{\gamma: \gamma(u^*) \neq \gamma(v^*)} \frac 1 {3^n} \cdot DA(\gamma) \ \ \ \ \ (5)

To see why Equation (5) is true, consider that the probability that S∗{S^*} outputs a particular transcript is exactly 1/P[S1Round∗≠FAIL]{1/\mathop{\mathbb P} [ S^*_{1Round} \neq FAIL]} times the probability that S1Round∗{S^*_{1Round}} outputs that transcript. Also, the probability that S1Round∗{S^*_{1Round}} outputs a transcript which involves (u∗,v∗){(u^*,v^*)} at the second round and which is accepted by D(){D()} conditioned on γ{\gamma} being the coloring selected at the beginning is DA(γ){DA(\gamma)} if γ{\gamma} is a coloring such that γ(u∗)≠γ(v∗){\gamma(u^*) \neq \gamma(v^*)}, and it is zero otherwise. Finally, S1Round∗{S^*_{1Round}} selects the initial coloring uniformly at random among all possible 3n{3^n} coloring.

From our security assumption on (C,O){(C,O)} and from Lemma 6 in Lecture 27 we have

∣P[S1Round∗≠FAIL]−23∣≤ϵ4∣E∣     (6)\displaystyle \left| \mathop{\mathbb P} [ S^*_{1Round} \neq FAIL] - \frac 23 \right| \leq \frac{\epsilon}{4|E|} \ \ \ \ \ (6)

and so the claim we made in Equation (3) follows from Equation (4), Equation (5), Equation (6) and the fact that if p,q{p,q} are quantities such that 32p≤1{\frac 32 p \leq 1}, 1q⋅p≤1{\frac 1q \cdot p \leq 1}, and ∣q−23∣≤δ≤16{\left|q - \frac 23 \right| \leq \delta \leq \frac 16} (so that q≥1/2{q \geq 1/2}), then

∣32p−1qp∣=32⋅p⋅1q⋅∣q−23∣≤2δ\displaystyle \left| \frac 32 p - \frac 1q p \right| = \frac 32 \cdot p \cdot \frac 1q \cdot \left| q- \frac 23 \right| \leq 2 \delta

(We use the above inequality with q=P[S1Round∗≠FAIL]{q = \mathop{\mathbb P} [ S^*_{1Round} \neq FAIL]}, δ=ϵ/4∣E∣{\delta = \epsilon/4|E|}, and p=∑γ:γ(u∗)≠γ(v∗)13nDA(γ){p = \sum_{\gamma: \gamma(u^*) \neq\gamma(v^*)}\frac 1 {3^n} DA(\gamma)}.)

Having proved that Equation (3) holds, we get

∣P[A(\mboxDistribution1)=1]−P[A(\mboxDistribution2)=1]∣≥ϵ2∣E∣\displaystyle | \mathop{\mathbb P} [ A( \mbox{Distribution 1} ) = 1 ] - \mathop{\mathbb P} [ A( \mbox{Distribution 2} ) = 1 ] | \geq \frac \epsilon {2|E|}

where A{A} is an algorithm of complexity at most 2t+O(nr){2t + O(nr)}. Now by a proof similar to that of Theorem 3 in Lecture 27, we have that (C,O){(C,O)} is not (2t+O(nr),ϵ/(2∣E∣n)){(2t +O(nr), \epsilon/(2|E|n))} secure.