2 releases

0.2.5 Jan 15, 2023
0.2.3 Jan 15, 2023
0.1.11 Apr 28, 2023
0.1.10 Jan 17, 2023
0.1.0 Apr 6, 2022

#8 in #elgamal

43 downloads per month
Used in zero-network

Apache-2.0

12KB
188 lines

ElGamal Encryption crates.io badge

This crate provides additive homomorphic ElGamal encryption over jubjub curve and also supports fully no_std and parity-scale-codec.

Scheme

Alice has balance $a$ and public key $b$.
She generates the randomness $r$ and computes encrypted balance $(g^r, g^a * b^r)$.
When Bob transfers $c$ to Alice, he generates the randomness $r'$ and computes encrypted transfer amount $(g^{r'}, g^c * b^{r'})$.
The sum of encrypted balance and transfer amount is folloing.

$$ (g^{r + r'}, g^{a + c} * b^{r + r'}) $$

Dependencies

~4.5MB
~98K SLoC