3 releases

0.0.12 Nov 5, 2023
0.0.11 Aug 22, 2023
0.0.10 Jul 27, 2023

#49 in #zkp

Download history 3/week @ 2024-02-15 19/week @ 2024-02-22 10/week @ 2024-02-29 9/week @ 2024-03-07 42/week @ 2024-03-14

72 downloads per month

Apache-2.0

210KB
5K SLoC

ElGamal Encryption

CI crates.io badge Documentation GitHub license codecov dependency status

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 $(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'}) $$

Test

$ cargo test

Dependencies

~2.7–3.5MB
~74K SLoC