ElGamal Encryption
This crate provides additive homomorphic ElGamal encryption over jubjub curve and also supports fully no_std and parity-scale-codec.
Specification
Alice has balance $a$ and public key $b$.
She generates the randomness $r$ and computes encrypted balance $(gr, ga * br)$.
When Bob transfers $c$ to Alice, he generates the randomness $r'$ and computes encrypted transfer amount $(g{r'}, gc * b{r'})$.
The sum of encrypted balance and transfer amount is folloing.
$$ (g{r + r'}, g{a + c} * b^{r + r'}) $$
Test
$ cargo test