she-elgamal

Crates.ioshe-elgamal
lib.rsshe-elgamal
version0.0.12
sourcesrc
created_at2023-07-27 07:00:02.308982
updated_at2023-11-05 03:21:41.002189
descriptionlifted elgamal encryption implementation
homepagehttps://github.com/KogarashiNetwork/Kogarashi/
repositoryhttps://github.com/KogarashiNetwork/Kogarashi/
max_upload_size
id927168
size15,302
(ashWhiteHat)

documentation

README

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
Commit count: 1240

cargo fmt