slowli / elastic-elgamal

ElGamal encryption and related zero-knowledge proofs
Apache License 2.0
15 stars 7 forks source link

Rerandomise ciphertext #119

Open tcerqueira opened 1 month ago

tcerqueira commented 1 month ago

Feature request

A rerandomise and rerandomise_with methods to rerandomise a ciphertext

Why?

To easily rerandomise ciphertexts.

Alternatives

I'm not experienced and I'm having a hard time figuring out how to achieve this.

For reference here's how another crate implements it and how I was trying to implement it: https://docs.rs/rust-elgamal/latest/rust_elgamal/struct.EncryptionKey.html#method.rerandomise https://docs.rs/rust-elgamal/latest/rust_elgamal/struct.EncryptionKey.html#method.rerandomise_with

slowli commented 2 weeks ago

If I understand the proposed functionality correctly, it's equivalent to adding a ciphertext of zero to the provided ciphertext. A ciphertext of zero can be obtained using PublicKey::encrypt or PublicKey::encrypt_zero (in the latter case, together with a ZKP that the ciphertext indeed encrypts zero). The only piece of functionality not immediately available is specifying the blinding factor; please, let me know if you need it specifically.

tcerqueira commented 2 weeks ago

Correct! I was using the other interface to avoid one rng but it was not necessary, so: no, I don't need specifically.