Function elgamal::add_ciphertexts
source · pub fn add_ciphertexts(
lhs: Ciphertext,
rhs: Ciphertext
) -> Result<Ciphertext, Error>
Expand description
Elgamal ciphertexts under the same encryption key enjoy an additive homomorphism,
i.e. if c1 = Enc(ek, m1)
and c2 = Enc(pk, m2)
, then we can define an addition operation +
such that
Dec(dk, c1 + c2) = m1 + m2
.
The addition is defined as componentwise application of the group operation on the pairs of group elements that make up ciphertexts.