P

Pedersen-Commitment

bfc987d1 add README · by K1531112

Pedersen Commitment

Project includes python implementation of Pedersen Commitment Scheme.

How to use

example.py contains code examples to perform the RAPPOR algorithm.

Creating Commitments

from PC import PCProver, PCVerifier

Initialise the parameters.

pc = PCProver(self, g=5, p=2333, s=15)
params = pc.getParams()
verifier = PCVerifier(params)

Create commitments with a message and random integer.

m1, c1 = pc.commit("Hello!", 7)
m2, c2 = pc.commit("Goodbye!", 9)

Send the commitments first.

verifier.add(c1)
verifier.add(c2)

When the prover wants to reveal messages, they can be sent to the verifier and finally confirms the messages.

verifier.add(m1)
verifier.add(m2)
print(verifier.verify())

Parameters

Name Description Rules
g Generator value. Must be a positive integer between 1 and q - 1.
p Prime number that will produce q = 2p + 1. Must be a prime.
s Secret value used to create h = gs mod q. Must be a positive integer between 1 and q - 1.