Docsity

Zero Knowledge Proofs and Their Applications, Lecture notes of Mathematics

Toggle sidebar
bg1
1In case you are curious, the factors of ๐‘šare
1,172,192,558,529,627,184,841,954,822,099
and 328,963,108,995,562,790,517,498,071,717.
13
Zero knowledge proofs
The notion of proof is central to so many fields. In mathematics, we
want to prove that a certain assertion is correct. In other sciences, we
often want to accumulate a preponderance of evidence (or statistical
significance) to reject certain hypotheses. In criminal law the prose-
cution famously needs to prove its case โ€œbeyond a reasonable doubtโ€.
Cryptography turns out to give some new twists on this ancient no-
tion.
Typically a proof that some assertion X is true, also reveals
some information about why X is true. When Hercule Poirot
proves that Norman Gale killed Madame Giselle he does so by
showing how Gale committed the murder by dressing up as a flight
attendant and stabbing Madame Gisselle with a poisoned dart.
Could Hercule convince us beyond a reasonable doubt that Gale
did the crime without giving any information on how the crime
was committed? Can the Russians prove to the U.S. that a sealed
box contains an authentic nuclear warhead without revealing
anything about its design? Can I prove to you that the number ๐‘š=
385,608,108,395,369,363,400,501,273,594,475,104,405,448,848,047,062,278,473,983
has a prime factor whose last digit is 7without giving you any infor-
mation about ๐‘šโ€™s prime factors? We wonโ€™t answer the first question,
but will show some insights on the latter two.1
Zero knowledge proofs are proofs that fully convince that a statement
is true without yielding any additional knowledge. So, after seeing a zero
knowledge proof that ๐‘šhas a factor ending with 7, youโ€™ll be no closer
to knowing ๐‘šโ€™s factorization than you were before. Zero knowledge
proofs were invented by Goldwasser, Micali and Rackoff in 1982 and
have since been used in great many settings. How would you achieve
such a thing, or even define it? And why on earth would it be useful?
This is the topic of this lecture.
Compiled on 11.17.2021 22:35
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff

Partial preview of the text

Download Zero Knowledge Proofs and Their Applications and more Lecture notes Mathematics in PDF only on Docsity!

(^1) In case you are curious, the factors of ๐‘š are 1, 172, 192, 558, 529, 627, 184, 841, 954, 822, 099 and 328, 963, 108, 995, 562, 790, 517, 498, 071, 717.

Zero knowledge proofs

The notion of proof is central to so many fields. In mathematics, we want to prove that a certain assertion is correct. In other sciences, we often want to accumulate a preponderance of evidence (or statistical significance) to reject certain hypotheses. In criminal law the prose- cution famously needs to prove its case โ€œbeyond a reasonable doubtโ€. Cryptography turns out to give some new twists on this ancient no- tion. Typically a proof that some assertion X is true, also reveals some information about why X is true. When Hercule Poirot proves that Norman Gale killed Madame Giselle he does so by showing how Gale committed the murder by dressing up as a flight attendant and stabbing Madame Gisselle with a poisoned dart. Could Hercule convince us beyond a reasonable doubt that Gale did the crime without giving any information on how the crime was committed? Can the Russians prove to the U.S. that a sealed box contains an authentic nuclear warhead without revealing anything about its design? Can I prove to you that the number ๐‘š = 385, 608, 108, 395, 369, 363, 400, 501, 273, 594, 475, 104, 405, 448, 848, 047,062, 278, 473, 983 has a prime factor whose last digit is 7 without giving you any infor- mation about ๐‘šโ€™s prime factors? We wonโ€™t answer the first question, but will show some insights on the latter two.^1 Zero knowledge proofs are proofs that fully convince that a statement is true without yielding any additional knowledge. So, after seeing a zero knowledge proof that ๐‘š has a factor ending with 7 , youโ€™ll be no closer to knowing ๐‘šโ€™s factorization than you were before. Zero knowledge proofs were invented by Goldwasser, Micali and Rackoff in 1982 and have since been used in great many settings. How would you achieve such a thing, or even define it? And why on earth would it be useful? This is the topic of this lecture.

Compiled on 11.17.2021 22:

272 an intensive introduction to cryptography

(^2) To be fair, โ€œonlyโ€ about 170 million Americans live in the 50 largest metropolitan areas and so arguably many people will survive at least the initial impact of a nuclear war, though it had been estimated that even a โ€œsmallโ€ nuclear war involving detonation of 100 not too large warheads could have devastating global consequences.

P This chapter will rely on the notion of NP complete- ness , as well as the view of NP as proof systems. For a review of this notion, please see this chapter of my introduction to TCS text.

13.1 APPLICATIONS FOR ZERO KNOWLEDGE PROOFS.

Before we talk about how to achieve zero knowledge, let us discuss some of its potential applications:

13.1.1 Nuclear disarmament The United States and Russia have reached a dangerous and expensive equilibrium where each has about 7000 nuclear warheads, much more than is needed to decimate each othersโ€™ population (and the popu- lation of much of the rest of the world).^2 Having so many weapons increases the chance of โ€œleakageโ€ of weapons, or of an accidental launch (which can result in an all out war) through fault in com- munications or rogue commanders. This also threatens the delicate balance of the Non-Proliferation Treaty which at its core is a bargain where non-weapons states agree not to pursue nuclear weapons and the five nuclear weapon states agree to make progress on nuclear dis- armament. These huge quantities of nuclear weapons are not only dangerous, as they increase the chance of a leak or of an individual failure or rogue commander causing a world catastrophe, but also extremely expensive to maintain. For all of these reasons, in 2009, U.S. President Obama called to set as a long term goal a โ€œworld without nuclear weaponsโ€ and in 2012 spoke concretely about talking to Russia about reducing โ€œnot only our strategic nuclear warheads, but also tactical weapons and war- heads in reserveโ€. On the other side, Russian President Putin has said already in 2000 that he sees โ€œno obstacles that could hamper future deep cuts of strategic offensive armamentsโ€. (Though as of 2018, po- litical winds on both sides have shifted away from disarmament and more toward armament.) There are many reasons why progress on nuclear disarmament has been so slow, and most of them have nothing to do with zero knowl- edge or any other piece of technology. But there are some technical hurdles as well. One of those hurdles is that for the U.S. and Russia to go beyond restricting the number of deployed weapons to significantly reducing the stockpiles , they need to find a way for one country to ver- ifiably prove that it has dismantled warheads. As mentioned in my work with Glaser and Goldston (see also this page), a key stumbling block is that the design of a nuclear warhead is of course highly clas-

274 an intensive introduction to cryptography

(^4) Integers can be coded as sets in various ways. For example, one can encode 0 as โˆ… and if ๐‘ is the set encoding ๐‘›, we can encode ๐‘› + 1 using the ๐‘› + 1- element set {๐‘} โˆช ๐‘.

13.2 DEFINING AND CONSTRUCTING ZERO KNOWLEDGE PROOFS

So, zero knowledge proofs are wonderful objects, but how do we get them? In fact, we havenโ€™t answered the even more basic question of how do we define zero knowledge? We have to start by the most basic task of defining what we mean by a proof. A proof system can be thought of as an algorithm ๐‘‰ (for โ€œverifierโ€) that takes as input a statement which is some string ๐‘ฅ and another string ๐œ‹ known as the proof and outputs 1 if and only if ๐œ‹ is a valid proof that the statement ๐‘ฅ is correct. For example:

  • In Euclidean geometry , statements are geometric facts such as โ€œin any triangle the degrees sum to 180 degreesโ€ and the proofs are step by step derivations of the statements from the five basic postulates.
  • In Zermelo-Fraenkel + Axiom of Choice (ZFC) a statement is some purported fact about sets (e.g., the Riemann Hypothesis^4 ), and a proof is a step by step derivation of it from the axioms.
  • We can define many other โ€œtheoriesโ€. For example, a theory where the statements are pairs (๐‘ฅ, ๐‘š) such that ๐‘ฅ is a quadratic residue modulo ๐‘š and a proof for ๐‘ฅ is the number ๐‘  such that ๐‘ฅ = ๐‘ ^2 (mod ๐‘š), or a theory where the theorems are Hamiltonian graphs ๐บ (graphs on ๐‘› vertices that contain an ๐‘›-long cycle) and the proofs are the description of the cycle.

All these proof systems have the property that the verifying algo- rithm ๐‘‰ is efficient. Indeed, thatโ€™s the whole point of a proof ๐œ‹- itโ€™s a sequence of symbols that makes it easy to verify that the statement is true. To achieve the notion of zero knowledge proofs, Goldwasser and Micali had to consider a generalization of proofs from static sequences of symbols to interactive probabilistic protocols between a prover and a verifier. Letโ€™s start with an informal example. The vast majority of humans have three types of cone cells in their eyes. The reason why we perceive the sky as blue (see also this), despite its color being quite a different spectrum than the blue of the rainbow, is that the projection of the skyโ€™s color to our cones is closest to the projection of blue. It has been suggested that a tiny fraction of the human population might have four functioning cones (in fact, only women, as it would require two X chromosomes and a certain mutation). How would a person prove to another that she is a in fact such a tetrachromat?

Proof of tetrachromacy: Suppose that Alice is a tetrachromat and can dis- tinguish between the colors of two pieces of plastic that would be identical to a trichromat. She wants to

zero knowledge proofs 275

prove to a trichromat Bob that the two pieces are not identical. She can do this as follows: Alice and Bob will repeat the following experi- ment ๐‘› times: Alice turns her back and Bob tosses a coin and with probability 1/2 leaves the pieces as they are, and with probability 1/2 switches the right piece with the left piece. Alice needs to guess whether Bob switched the pieces or not. If Alice is successful in all of the ๐‘› repetitions then Bob will have 1 โˆ’ 2โˆ’๐‘›^ confidence that the pieces are truly different.

A similar โ€œproofโ€ inspired the influential notion of hypothesis test- ing in statistics. Dr. Muriel Bristol said that she prefers the taste of tea when the milk is put first into the cup and tea later, rather than vice versa. The statistician Ronald Fisher did not believe her. William Roach (like Bristol, a chemist, and her future husband) proposed a probabilistic test, whereby eight cups would be poured for Bristol, each randomly chosen to either be โ€œmilk firstโ€ or โ€œtea firstโ€. Bristol correctly identified all 8 cups. Pondering about this experiment, and the level of confidence that it enabled to reject the โ€œnull hypothesisโ€ that Bristol simply guessed randomly led to Fisherโ€™s development of hypothesis testing and the now ubiquitous โ€œ๐‘ valuesโ€. We now consider a more โ€œmathematicalโ€ example along simi- lar lines. Recall that if ๐‘ฅ and ๐‘š are numbers then we say that ๐‘ฅ is a quadratic residue modulo ๐‘š if there is some ๐‘  such that ๐‘ฅ = ๐‘ ^2 (mod ๐‘š). Let us define the function NQR (๐‘š, ๐‘ฅ) to output 1 if and only if ๐‘ฅ โ‰  ๐‘ ^2 (mod ๐‘š) for every ๐‘  โˆˆ {0, โ€ฆ , ๐‘š โˆ’ 1}. There is a very simple way to prove statements of the form โ€œ NQR (๐‘š, ๐‘ฅ) = 0โ€: just give out ๐‘ . However, here is an interactive proof system to prove statements of the form โ€œ NQR (๐‘š, ๐‘ฅ) = 1โ€:

  • We have two parties: Alice and Bob. The common input is (๐‘š, ๐‘ฅ) and Alice wants to convince Bob that NQR (๐‘š, ๐‘ฅ) = 1. (That is, that ๐‘ฅ is not a quadratic residue modulo ๐‘š).
  • We assume that Alice can compute NQR (๐‘š, ๐‘ค) for every ๐‘ค โˆˆ {0, โ€ฆ , ๐‘š โˆ’ 1} but Bob is polynomial time.
  • The protocol will work as follows:
  1. Bob will pick some random ๐‘  โˆˆ โ„คโˆ—๐‘š (e.g., by picking a random number in {1, โ€ฆ , ๐‘š โˆ’ 1} and discard it if it has nontrivial g.c.d. with ๐‘š) and toss a coin ๐‘ โˆˆ {0, 1}. If ๐‘ = 0 then Bob will send ๐‘ ^2 (mod ๐‘š) to Alice and otherwise he will send ๐‘ฅ๐‘ ^2 (mod ๐‘š) to Alice.
  2. Alice will use her ability to compute NQR (๐‘š, โ‹…) to respond with ๐‘โ€ฒ^ = 0 if Bob sent a quadratic residue and with ๐‘โ€ฒ^ = 1 otherwise.

zero knowledge proofs 277

(^5) People have considered the notion of zero knowl- edge systems where soundness holds only with re- spect to efficient provers; these are known as argument systems.

soundness condition holds even if the prover uses a non efficient strategy.^5 We say that a proof system has an efficient prover if there is an NP-type proof system ฮ  for ๐ฟ (that is some efficient algorithm ฮ  such that there exists ๐œ‹ with ฮ (๐‘ฅ, ๐œ‹) = 1 iff ๐‘ฅ โˆˆ ๐ฟ and such that ฮ (๐‘ฅ, ๐œ‹) = 1 implies that |๐œ‹| โ‰ค ๐‘๐‘œ๐‘™๐‘ฆ(|๐‘ฅ|), such that the strategy for ๐‘ƒ can be implemented efficiently given any static proof ๐œ‹ for ๐‘ฅ in this system.

R Remark 13.3 โ€” Notation for strategies. Up until now, we always considered cryptographic protocols where Alice and Bob trusted one another, but were worried about some adversary controlling the channel between them. Now we are in a somewhat more โ€œsuspiciousโ€ setting where the parties do not fully trust one an- other. In such protocols there is always a โ€œprescribedโ€ or honest strategy that a particular party should fol- low, but we generally donโ€™t want the other partiesโ€™ security to rely on someone elseโ€™s good intention, and hence analyze also the case where a party uses an arbi- trary malicious strategy. We sometimes also consider the honest but curious case where the adversary is passive and only collects information, but does not deviate from the prescribed strategy. Protocols typically only guarantee security for party A when it behaves honestly - a party can always chose to violate its own security and there is not much we can (or should?) do about it.

13.3 DEFINING ZERO KNOWLEDGE

So far we merely defined the notion of an interactive proof system, but we need to define what it means for a proof to be zero knowledge. Before we attempt a definition, let us consider an example. Going back to the notion of quadratic residuosity, suppose that ๐‘ฅ and ๐‘š are public and Alice knows ๐‘  such that ๐‘ฅ = ๐‘ ^2 (mod ๐‘š). She wants to convince Bob that this is the case. However she prefers not to reveal ๐‘ . Can she convince Bob that such an ๐‘  exists without revealing any information about it? Here is a way to do so:

Protocol ZK-QR: Public input for Alice and Bob: ๐‘ฅ, ๐‘š; Aliceโ€™s private input is ๐‘  such that ๐‘ฅ = ๐‘ ^2 (mod ๐‘š).

  1. Alice will pick a random ๐‘ โ€ฒ^ and send to Bob ๐‘ฅโ€ฒ^ = ๐‘ฅ๐‘ โ€ฒ2^ (mod ๐‘š).
  2. Bob will pick a random bit ๐‘ โˆˆ {0, 1} and send ๐‘ to Alice.
  3. If ๐‘ = 0 then Alice reveals ๐‘ ๐‘ โ€ฒ, hence giving out a root for ๐‘ฅโ€ฒ; if ๐‘ = 1 then Alice reveals ๐‘ โ€ฒ, hence showing a root for ๐‘ฅโ€ฒ๐‘ฅโˆ’1.

278 an intensive introduction to cryptography

  1. Bob checks that the value ๐‘ โ€ณ^ revealed by Alice is indeed a root of ๐‘ฅโ€ฒ๐‘ฅโˆ’๐‘, if so then it โ€œacceptsโ€ the proof.

If ๐‘ฅ was not a quadratic residue then no matter how ๐‘ฅโ€ฒ^ was chosen, either ๐‘ฅโ€ฒ^ or ๐‘ฅโ€ฒ๐‘ฅโˆ’1^ is not a residue and hence Bob will reject the proof with probability at least 1/2. By repeating this ๐‘› times, we can reduce the probability of Bob accepting the proof of a non residue to 2 โˆ’๐‘›. On the other hand, we claim that we didnโ€™t really reveal anything about ๐‘ . Indeed, if Bob chooses ๐‘ = 0, then the two messages (๐‘ฅโ€ฒ, ๐‘ ๐‘ โ€ฒ) he sees can be thought of as a random quadratic residue ๐‘ฅโ€ฒ^ and its root. If Bob chooses ๐‘ = 1 then after dividing by ๐‘ฅ (which he could have done by himself) he still gets a random residue ๐‘ฅโ€ณ^ and its root ๐‘ โ€ฒ. In both cases, the distribution of these two messages is completely in- dependent of ๐‘ , and hence intuitively yields no additional information about it beyond whatever Bob knew before. To define zero knowledge mathematically we follow the following intuition:

A proof system is zero knowledge if the verifier did not learn anything after the interaction that he could not have learned on his own.

Despite the name โ€œzero knowledgeโ€, we do not claim that the ver- ifier does not know anything about the private input ๐‘ฅ. For example, if 1๐‘š = ๐‘ โ‹… ๐‘ž for two primes ๐‘, ๐‘ž, then each ๐‘  โˆˆ โ„คโˆ—๐‘š has at most four square roots, and if the verifier could compute square roots then they can narrow ๐‘ฅ down to these four possibilities. However, the point is that this is knowledge that the verifier already even before the interac- tion with the prover, and so participating in the proof resulted in zero additional knowledge. Here is how we formally define zero knowledge:

Definition 13.4 โ€” Zero knowledge proofs. A proof system (๐‘ƒ , ๐‘‰ ) for ๐‘“ is zero knowledge if for every efficient verifier strategy ๐‘‰ โˆ—^ there exists an efficient probabilistic algorithm ๐‘†โˆ—^ (known as the simulator ) such that for every ๐‘ฅ s.t. ๐‘“(๐‘ฅ) = 1 , the following random variables are computationally indistinguishable:

  • The output of ๐‘‰ โˆ—^ after interacting with ๐‘ƒ on input ๐‘ฅ.
  • The output of ๐‘†โˆ—^ on input ๐‘ฅ.

That is, we can show the verifier does not gain anything from the interaction, because no matter what algorithm ๐‘‰ โˆ—^ he uses, whatever he learned as a result of interacting with the prover, he could have just

280 an intensive introduction to cryptography

  • ๐‘‰ 2 (๐‘ฅ, ๐‘š, ๐‘ฅโ€ฒ, ๐‘ โ€ณ) is whatever Bob outputs after seeing Aliceโ€™s re- sponse ๐‘ โ€ณ^ to the bit ๐‘.

Both ๐‘‰ 1 and ๐‘‰ 2 are efficiently computable. We now need to come up with an efficient simulator ๐‘†โˆ—^ that is a standalone algorithm that on input ๐‘ฅ, ๐‘š will output a distribution indistinguishable from the output ๐‘‰ โˆ—. The simulator ๐‘†โˆ—^ will work as follows:

  1. Pick ๐‘โ€ฒ^ โ†๐‘… {0, 1}.
  2. Pick ๐‘ โ€ณ^ at random in โ„คโˆ—๐‘š. If ๐‘ = 0 then let ๐‘ฅโ€ฒ^ = ๐‘ โ€ณ^2 (mod ๐‘š). Otherwise output ๐‘ฅโ€ฒ^ = ๐‘ฅ๐‘ โ€ณ^2 (mod ๐‘š).
  3. Let ๐‘ = ๐‘‰ 1 (๐‘ฅ, ๐‘š, ๐‘ฅโ€ฒ). If ๐‘ โ‰  ๐‘โ€ฒ^ then go back to step 1.
  4. Output ๐‘‰ 2 (๐‘ฅ, ๐‘š, ๐‘ฅโ€ฒ, ๐‘ โ€ณ).

The correctness of the simulator follows from the following claims (all of which assume that ๐‘ฅ is actually a quadratic residue, since oth- erwise we donโ€™t need to make any guarantees and in any case Aliceโ€™s behaviour is not well defined): Claim 1: The distribution of ๐‘ฅโ€ฒ^ computed by ๐‘†โˆ—^ is identical to the distribution of ๐‘ฅโ€ฒ^ chosen by Alice. Claim 2: With probability at least 1/2, ๐‘โ€ฒ^ = ๐‘. Claim 3: Conditioned on ๐‘ = ๐‘โ€ฒ^ and the value ๐‘ฅโ€ฒ^ computed in step 2, the value ๐‘ โ€ณ^ computed by ๐‘†โˆ—^ is identical to the value that Alice sends when her first message is ๐‘ฅโ€ฒ^ and Bobโ€™s response is ๐‘. Together these three claims imply that in expectation ๐‘†โˆ—^ only in- vokes ๐‘‰ 1 and ๐‘‰ 2 a constant number of times (since every time it goes back to step 1 with probability at most 1/2). They also imply that the output of ๐‘†โˆ—^ is in fact identical to the output of ๐‘‰ โˆ—^ in a true interaction with Alice. Thus, we only need to prove the claims, which is actually quite easy: Proof of Claim 1: In both cases, ๐‘ฅโ€ฒ^ is a random quadratic residue. QED (Claim 1) Proof of Claim 2: This is a corollary of Claim 1; since the distribu- tion of ๐‘ฅโ€ฒ^ is identical to the distribution chosen by Alice, in particular ๐‘ฅโ€ฒ^ gives out no information about the choice of ๐‘โ€ฒ. QED (Claim 2) Proof of Claim 3: This follows from a direct calculation. The value ๐‘ โ€ณ^ sent by Alice is a square root of ๐‘ฅโ€ฒ^ if ๐‘ = 0 and of ๐‘ฅโ€ฒ๐‘ฅโˆ’1^ if ๐‘ฅ = 1. But this is identical to what happens for ๐‘†โˆ—^ if ๐‘ = ๐‘โ€ฒ. QED (Claim 3) Together these complete the proof of the theorem. โ– 

Theorem 13.6 is interesting but not yet good enough to guarantee security in practice. After all, the protocol that we really need to show

zero knowledge proofs 281

is zero knowledge is the one where we repeat this procedure ๐‘› times. This is a general theorem that if a protocol is zero knowledge then repeating it polynomially many times one after the other (so called โ€œsequential repetitionโ€) preserves zero knowledge. You can think of this as cryptographyโ€™s version of the equality โ€œ0 + 0 = 0โ€, but as usual, intuitive things are not always correct and so this theorem does re- quire (a not super trivial) proof. It is a good exercise to try to prove it on your own. There are known ways to achieve zero knowledge with negligible soundness error and a constant number of communication rounds, see Goldreichโ€™s book (Vol 1, Sec 4.9).

13.4 ZERO KNOWLEDGE PROOF FOR HAMILTONICITY.

We now show a proof for another language. Suppose that Alice and Bob know an ๐‘›-vertex graph ๐บ and Alice knows a Hamiltonian cycle ๐ถ in this graph (i.e. a length ๐‘› simple cycle

  • one that traverses all vertices exactly once). Here is how Alice can prove that such a cycle exists without revealing any information about it.

Protocol ZK-Ham:

  1. Common input: graph ๐ป (in the form of an ๐‘› ร— ๐‘› adjacency ma- trix). Aliceโ€™s private input: a Hamiltonian cycle ๐ถ = (๐ถ 1 , โ€ฆ , ๐ถ๐‘›) which are distinct vertices such that (๐ถโ„“, ๐ถโ„“+1) is an edge in ๐ป for all โ„“ โˆˆ {1, โ€ฆ , ๐‘› โˆ’ 1} and (๐ถ๐‘›, ๐ถ 1 ) is an edge as well. Below we assume that ๐บ โˆถ {0, 1}๐‘›^ โ†’ {0, 1}3๐‘›^ is a pseudorandom generator.
  2. Bob chooses a random string ๐‘ง โˆˆ {0, 1}3๐‘›
  3. Alice chooses a random permutation ๐œ‹ on {1, โ€ฆ , ๐‘›} and let ๐‘€ be the ๐œ‹-permuted adjacency matrix of ๐ป (i.e., ๐‘€๐œ‹(๐‘–),๐œ‹(๐‘—) = 1 iff (๐‘–, ๐‘—) is an edge in ๐ป). For every ๐‘–, ๐‘—, Alice chooses a random string ๐‘ฅ๐‘–,๐‘— โˆˆ {0, 1}๐‘›^ and let ๐‘ฆ๐‘–,๐‘— = ๐บ(๐‘ฅ๐‘–,๐‘—) โŠ• ๐‘€๐‘–,๐‘—๐‘ง. She sends {๐‘ฆ๐‘–,๐‘—}๐‘–,๐‘—โˆˆ[๐‘›] to Bob.
  4. Bob chooses a bit ๐‘ โˆˆ {0, 1}.
  5. If ๐‘ = 0 then Alice sends out ๐œ‹ and the strings {๐‘ฅ๐‘–,๐‘—} for all ๐‘–, ๐‘—; if ๐‘ = 1 then Alice sends out the ๐‘› strings ๐‘ฅ๐œ‹(๐ถ 1 ),๐œ‹(๐ถ 2 ), โ€ฆ , ๐‘ฅ๐œ‹(๐ถ๐‘›),๐œ‹(๐ถ 1 ) together with their indices.
  6. If ๐‘ = 0 then Bob computes ๐‘€ to be the ๐œ‹-permuted adjacency matrix of ๐ป and verifies that all the ๐‘ฆ๐‘–,๐‘—โ€™s were computed from the ๐‘ฅ๐‘–,๐‘—โ€™s appropriately. If so then Bob accepts the proof, and otherwise it rejects it. If ๐‘ = 1 then Bob verifies that the indices of the strings {๐‘ฅ๐‘–,๐‘—} sent by Alice form a cycle and that indeed ๐‘ฆ๐‘–,๐‘— = ๐บ(๐‘ฅ๐‘–,๐‘—) โŠ• ๐‘ง

zero knowledge proofs 283

  1. We compute the fourth message of the protocol similarly to how Alice does it: if ๐‘ = 0 then it consists of ๐œ‹ and the strings {๐‘ฅ๐‘–,๐‘—} for all ๐‘–, ๐‘—; if ๐‘ = 1 then we pick a random length-๐‘› cycle ๐ถโ€ฒ^ and the message consists of the ๐‘› strings ๐‘ฅ๐ถ 1 โ€ฒ,๐ถ 2 โ€ฒ , โ€ฆ , ๐‘ฅ๐ถโ€ฒ๐‘›,๐ถโ€ฒ 1 together with their indices.
  2. Output whatever ๐‘‰ โˆ—^ outputs when given the prior message.

We prove the output of the simulator is indistinguishable from the output of ๐‘‰ โˆ—^ in an actual interaction by the following claims: Claim 1: The message {๐‘ฆ๐‘–,๐‘—} computed by ๐‘†โˆ—^ is computationally indistinguishable from the first message computed by Alice. Claim 2: The probability that ๐‘ = ๐‘โ€ฒ^ is at least 1/3. Claim 3: The fourth message computed by ๐‘†โˆ—^ is computationally indistinguishable from the fourth message computed by Alice. We will simply sketch here the proofs (see Goldreichโ€™s book for example for full proofs): For Claim 1, note that if ๐‘โ€ฒ^ = 0 then the message is identical to the way Alice computes it. If ๐‘โ€ฒ^ = 1 then the difference is that ๐‘†โˆ—^ computes some strings ๐‘ฆ๐‘–,๐‘— of the form ๐บ(๐‘ฅ๐‘–,๐‘—) + ๐‘ง where Alice would compute the corresponding strings as ๐บ(๐‘ฅ๐‘–,๐‘—) this is indistinguishable because ๐บ is a pseudorandom generator (and the distribution ๐‘ˆ3๐‘› โŠ• ๐‘ง is the same as ๐‘ˆ3๐‘›). Claim 2 is a corollary of Claim 1. If ๐‘‰ โˆ—^ managed to pick a message ๐‘ such that Pr[๐‘ = ๐‘โ€ฒ] < 1/2 โˆ’ ๐‘›๐‘’๐‘”๐‘™(๐‘›) then in particular it could distinguish between the first message of Alice (that is computed inde- pendently of ๐‘โ€ฒ^ and hence contains no information about it) from the first message of ๐‘‰ โˆ—. For Claim 3, note that again if ๐‘ = 0 then the message is computed in a way identical to what Alice does. If ๐‘ = 1 then this message is also computed in a way identical to Alice, since it does not matter if instead of picking ๐ถโ€ฒ^ at random, we picked a random permutation ๐œ‹ and let ๐ถโ€ฒ^ be the image of the Hamiltonian cycle under this permutation. This completes the proof of the theorem. โ– 

13.4.1 Why is this interesting? The reason that a protocol for Hamiltonicity is more interesting than a protocol for quadratic residuosity is that Hamiltonicity is an NP- complete problem. Specifically recall the following:

  • A function ๐น โˆถ {0, 1}โˆ—^ โ†’ {0, 1} is in NP if there exists a polynomial- time algorithm ๐‘‰๐น and some integer ๐‘ such that for every ๐‘ฅ โˆˆ {0, 1}โˆ—, ๐น (๐‘ฅ) = 1 iff there exists ๐‘ฆ โˆˆ {0, 1}|๐‘ฅ|๐‘ such that ๐‘‰๐น (๐‘ฅ, ๐‘ฆ) = 1. Many functions of interest in all areas of math, science, engineering, and more are in the class NP.

284 an intensive introduction to cryptography

  • Let HAM โˆถ {0, 1}โˆ—^ โ†’ {0, 1} be the function that maps a graph ๐บ to 1 if and only if ๐บ contains a Hamiltonian cycle. Then HAM โˆˆ NP. Indeed, this is demonstrated by the function ๐‘‰๐ป๐ด๐‘€ such that ๐‘‰๐ป๐ด๐‘€ (๐บ, ๐ถ) = 1 iff ๐ถ is a Hamiltonian cycle in the graph ๐บ.
  • The function HAM is NP-complete. Specifically for every ๐น , ๐‘‰๐น as above, there is are efficiently computable functions ๐‘Ÿ, ๐‘Ÿ๐ธ๐‘›๐‘๐‘œ๐‘‘๐‘’, ๐‘Ÿ๐ท๐‘’๐‘๐‘œ๐‘‘๐‘’ that satisfy the following:

a. (Completeness of reduction.) For every ๐‘ฅ, ๐‘ฆ such that ๐‘‰๐น (๐‘ฅ, ๐‘ฆ) = 1 , ๐‘‰๐ป๐ด๐‘€ (๐‘Ÿ(๐‘ฅ), ๐‘Ÿ๐ธ๐‘›๐‘๐‘œ๐‘‘๐‘’(๐‘ฅ, ๐‘ฆ)) = 1. In particular this means that for every ๐‘ฅ such that ๐น (๐‘ฅ) = 1, HAM (๐‘Ÿ(๐‘ฅ)) = 1. (Can you see why?) b. (Soundness of reduction.) For every ๐‘ฅ โˆˆ {0, 1}โˆ—, if there exists ๐ถ such that ๐‘‰๐ป๐ด๐‘€ (๐‘Ÿ(๐‘ฅ), ๐ถ) = 1 then ๐‘‰๐น (๐‘ฅ, ๐‘Ÿ๐ท๐‘’๐‘๐‘œ๐‘‘๐‘’(๐‘ฅ, ๐ถ)) = 1. In particular this means that for every ๐‘ฅ such that HAM (๐‘Ÿ(๐‘ฅ)) = 1, ๐น (๐‘ฅ) = 1. (Can you see why?)

Using the reduction above, we can transform the zero-knowledge proof for Hamiltonicity into a zero knowledge proof for every ๐น โˆˆ NP. Specifically, to prove that ๐น (๐‘ฅ) = 1, the verifier and prover will use the following system (see also Fig. 13.1).

  1. Public input: ๐‘ฅ. Proverโ€™s private input: ๐‘ฆ such that ๐‘‰๐น (๐‘ฅ, ๐‘ฆ) = 1.
  2. Verifier and prover will compute ๐บ = ๐‘Ÿ(๐‘ฅ). Prover will compute ๐ถ = ๐‘Ÿ๐ธ๐‘›๐‘๐‘œ๐‘‘๐‘’(๐‘ฅ, ๐‘ฆ).
  3. Verifier and prove run the Hamiltonicity zero knowledge protocol, with public input ๐บ and proverโ€™s private input ๐ถ. The verifierโ€™s output is the output in this protocol.

Figure 13.1 : Using a zero knowledge protocol for Hamiltonicity we can obtain a zero knowledge pro- tocol for any language ๐ฟ in NP. For example, if the public input is a SAT formula ๐œ‘ and the Proverโ€™s se- cret input is a satisfying assignment ๐‘ฅ for ๐œ‘ then the verifier can run the reduction on ๐œ‘ to obtain a graph ๐ป and the prover can run the same reduction to ob- tain from ๐‘ฅ a Hamiltonian cycle ๐ถ in ๐ป. They can then run the ZK-Ham protocol to prove that indeed ๐ป is Hamiltonian (and hence the original formula was satisfiable) without revealing any information the verifier could not have obtain on his own.

286 an intensive introduction to cryptography

13.5.1 โ€œBonus featuresโ€ of zero knowledge The following properties of zero knowledge systems are used in the literature. We might cover some in class, but mention them here. These are covered in Chapter 20 of Boneh-Shoup.

  • Proof of knowledge - it can be shown that the proof above of Hamil- tonicity yields more than soundness. We can โ€œextractโ€ from a prover startegy that succeeds in convincing the verifier that ๐บ is Hamiltonian with probability larger than 1/2 an actual Hamiltonian cycle. This means that the prover didnโ€™t just convince the verifier that there exists a Hamiltonian cycle in the graph ๐บ but also that the prover โ€œknowsโ€ it. This notion is known as a โ€œproof of knowledgeโ€.
  • Arguments - if a proof system only satisfies the soundness condi- tion with respect to polynomial-time provers, then it is called an argument system.
  • Succinct proofs - proofs that ๐น (๐‘ฅ) = 1 where total communication is a fixed polynomial in ๐‘› independently of the time to verify ๐น.

Combining succinct zero-knowledge proofs with the Fiat-Shamir heuristic for non-interactivity leads to the notion of zero-knowledge succinct arguments or ZK-SNARG. If these also satisfy a โ€œproof of knowledgeโ€ property then they are called ZK-SNARKs. These have recently been of great interest for crypto-currencies. See lectures 16- in Stanford CS 251, as well as this blog post.