5.3. sdzkp.prover

Classes

class sdzkp.prover.DishonestProver(grpc_stub, instance_id, number_of_rounds, num_variables)[source]

The DishonestProver class is responsible for setting up and executing rounds of a Zero-Knowledge Proof (ZKP) protocol for the Subgroup Distance Problem (SGD) derived from a Max2SAT instance. After initialization, the DishonestProver randomly choses a solution to the problem and tries to cheat the honest verifier.

grpc_stub

The gRPC stub for communication.

instance_id

A unique identifier for the problem instance.

Type:

str

number_of_rounds

The number of ZKP rounds to execute.

Type:

int

SGD

An instance of the Subgroup Distance Problem with a solution.

Type:

SubgroupDistanceProblemWithSolution

Initializes the Prover with a Max2SAT instance and converts it to a Subgroup Distance Problem.

Parameters:
  • grpc_stub – The gRPC stub for communication.

  • instance_id (str) – A unique identifier for the problem instance.

  • number_of_rounds (int) – The number of ZKP rounds to execute.

  • num_variables (int) – The number of variables in the Max2SAT instance.

commit(round_id)[source]

Generates commitments for a given round and sends them to the verifier. The DishonestProver randomly choses a solution to the problem and tries to cheat the honest verifier.

Parameters:

round_id (int) – The ID of the current round.

Returns:

The challenge received from the verifier.

Return type:

int

class sdzkp.prover.HonestProver(grpc_stub, instance_id, number_of_rounds, num_variables)[source]

The HonestProver class is responsible for setting up and executing rounds of a Zero-Knowledge Proof (ZKP) protocol for the Subgroup Distance Problem (SGD) derived from a Max2SAT instance. This is just inheriting Prover for convenience.

grpc_stub

The gRPC stub for communication.

instance_id

A unique identifier for the problem instance.

Type:

str

number_of_rounds

The number of ZKP rounds to execute.

Type:

int

SGD

An instance of the Subgroup Distance Problem with a solution.

Type:

SubgroupDistanceProblemWithSolution

Initializes the Prover with a Max2SAT instance and converts it to a Subgroup Distance Problem.

Parameters:
  • grpc_stub – The gRPC stub for communication.

  • instance_id (str) – A unique identifier for the problem instance.

  • number_of_rounds (int) – The number of ZKP rounds to execute.

  • num_variables (int) – The number of variables in the Max2SAT instance.

class sdzkp.prover.Prover(grpc_stub, instance_id, number_of_rounds, num_variables)[source]

The Prover class is responsible for setting up and executing rounds of a Zero-Knowledge Proof (ZKP) protocol for the Subgroup Distance Problem (SGD) derived from a Max2SAT instance.

grpc_stub

The gRPC stub for communication.

instance_id

A unique identifier for the problem instance.

Type:

str

number_of_rounds

The number of ZKP rounds to execute.

Type:

int

SGD

An instance of the Subgroup Distance Problem with a solution.

Type:

SubgroupDistanceProblemWithSolution

Initializes the Prover with a Max2SAT instance and converts it to a Subgroup Distance Problem.

Parameters:
  • grpc_stub – The gRPC stub for communication.

  • instance_id (str) – A unique identifier for the problem instance.

  • number_of_rounds (int) – The number of ZKP rounds to execute.

  • num_variables (int) – The number of variables in the Max2SAT instance.

setup()[source]

Sets up the Subgroup Distance Problem instance and sends it to the verifier via gRPC.

Returns:

True if the setup was successful, False otherwise.

Return type:

bool

commit(round_id)[source]

Generates commitments for a given round and sends them to the verifier.

Parameters:

round_id (int) – The ID of the current round.

Returns:

The challenge received from the verifier.

Return type:

int

response(round_id, c)[source]

Responds to the challenge from the verifier based on the commitments made.

Parameters:
  • round_id (int) – The ID of the current round.

  • c (int) – The challenge received from the verifier.

Returns:

The result of the current round and the overall verification result.

Return type:

tuple

run_round(round_id)[source]

Executes a single round of the ZKP protocol.

Parameters:

round_id (int) – The ID of the round.

run()[source]

Runs the entire ZKP protocol for the specified number of rounds.