A Cut-and-Choose protocol for proving that a number is a square mod . The part is trivial to check efficiently by any verifier itself. The interesting part is , i.e. that has a square root. This is an interesting statement because if is the product of two large random primes, then it’s difficult to decide whether any given has a square root or not.
Notation
We drop the "" from expressions below, but any computation involving elements from is understood to be .
This protocol is very similar to Graph Isomorphism Protocol.
The main idea
Following the Cut-and-Choose paradigm, the protocol splits and square root into
- for a random value .
Intuition
The two parts read as
- is a square (with random square root )
- is a square (with random square root )
Then we get the two required properties (see Splitting the statement into parts):
- Neither nor on their own reveal anything about (given that is a random group element from )
- Together, and reveal .
The protocol
Following the The protocol template:
Protocol between and
- Announcement: Prover chooses a random and sends announcement .
- Challenge: The verifier chooses a random challenge (challenging the prover to reveal the square root of ).
- Response: The prover reveals
- The verifier checks that and .
Optimization of the Cut-and-Choose template
Instead of sending both “split” instances and , we simply send , given that the verifier already knows . In the verification equation, the verifier adds the "" itself, if needed.
The ZK property
This follows Typical simulator outline.
The Zero Knowledge (Classical) simulator for (malicious) verifier works as follows:
Simulator
- computes a random transcript of the protocol:
- chooses a random challenge
- chooses a random response
- computes the unique fitting announcement
- rejects challenges not consistent with what would output:
- chooses randomness and computes
- If , then output the view Otherwise, start from the beginning and try again.
The PoK property
For simplicity, we assume that the prover has probability 1 to convince an honest verifier, which puts us into the A simplified toy definition scenario. The extractor for prover works as follows:
Extractor
- retrieves the prover’s announcement (for some random )
- retrieves the prover’s response for both challenges as
- From the verification equations, we get and
- outputs the witness
Formally, the witness is correct because .
Non-simplified scenario
Theorem: the quadratic residue protocol is a Proof of Knowledge (Classical) with knowledge error .
For a prover that may not answer all challenges correctly always (but convinces the verifier with probability ), it may happen that when gets the two responses in the second step, one or more of them is actually invalid, i.e. fails the verification equation. In that case, the response is useless for the extractor. In that scenario, will have to restart and try different prover randomness . Using a counting argument, one can show that for some , the prover has to be able to answer both challenges (otherwise it cannot be convincing with probability larger than ). The extractor then tries different until it finds one for which both challenges can be answered.