didiercrunch / paillier

Paillier cryptosystem implemented in Go
MIT License
20 stars 16 forks source link

Added EncryptWithR allowing to specify the randomness #6

Closed pdyraga closed 6 years ago

pdyraga commented 6 years ago

Function EncryptWithR lets to specify randomness r explicitly. For some ZKPs based on the Paillier scheme, it's required to use the same r for encryption and construction of ZKP. It wasn't possible previously, because r was generated internally and never returned.

I did not want to modify Encrypt to return r because it would break existing code using this API, as well as, I wanted to make sure person using the specific r and using it somewhere else really knows what he's doing.

pdyraga commented 6 years ago

Sorry, my bad, was to eager with opening the PR. Want to pass it through review and merge internally first.