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.
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.
As a side note, can you point me to the ZNP that you talk about. I would like to know how they use r in them.
many thanks,
didier
Fantastic. As always, outstanding code.
As a side note, can you point me to the ZNP that you talk about. I would like to know how they use `r` in them.
many thanks,
didier
Sure! For example, Gennaro's ZKP allowing to construct range commitment for key pair (η, y=g^x) with encrypted w = E(η):
Sure! For example, Gennaro's ZKP allowing to construct range commitment for key pair (η, y=g^x) with encrypted w = E(η):

Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Function
EncryptWithRlets to specify randomnessrexplicitly. Forsome ZKPs based on the Paillier scheme, it's required to use the same
rfor encryption and construction of ZKP. It wasn't possible previously,because
rwas generated internally and never returned.I did not want to modify
Encryptto returnrbecause it would breakexisting code using this API, as well as, I wanted to make sure person
using the specific
rand using it somewhere else really knows whathe's doing.
Fantastic. As always, outstanding code.
As a side note, can you point me to the ZNP that you talk about. I would like to know how they use
rin them.many thanks,
didier
Sure! For example, Gennaro's ZKP allowing to construct range commitment for key pair (η, y=g^x) with encrypted w = E(η):