[][src]Crate elgamal_curve25519

ElGamal Homomorphic Encryption Library

A Rust library for ElGamal Homomorphic Encryption. ElGamal encryption is only usable for small values (32 bytes) and so it's generally used in hybrid encryption schemes.
This library implements ElGamal multiplicative homomorphic encryption, so messages can be multiplicatevely aggregated by multiplying their cyphertexts. Aggregated cyphertexts can be decrypted only if they have the same recipient and only by that recipient.
The scheme has different applications, ranging from online voting systems to secure multy-party computation for cryptocurrencies.

Structs

CypherText

CypherText is the cyphertext generated by ElGamal encryption.

KeyPair

KeyPair is a pair of ElGamal PublicKey and PrivateKey.

Message

Message is an ElGamal message.

PrivateKey

PrivateKey is an ElGamal private key. It's just a wrapper around Scalar. The key is just an integer between 1 and q-1, where q is the order of the group G.

PublicKey

PublicKey is an ElGamal public key. It's just a wrapper around CompressedRistretto. The key is computed as g^x, where g is the generator of the group G of order q, and x a PrivateKey.

Enums

Error

Error is the library error type.

Functions

decrypt

decrypt decrypts a CypherText into a Message.

encrypt

encrypt encrypts a Message into a CypherText.

Type Definitions

Result

Result is the type used for fallible outputs. It's an alias to the Result type in standard library whith error the library Error type.