Skip to main content

Threshold ElGamal cryptosystem

Project description

Threshold ElGamal cryptosystem

This is a library that provides methods for threshold encryption, decryption and DKG (distributed key generation) algorithm using the ElGamal cryptosystem. Threshold ElGamal encryption and decryption algorithms were based on Cachin's work, and the algorithm used for distributed key pair generation was based on a 1999 paper by Gennaro et al. Both algorithms use a form of secret sharing first introduced in a 1979 paper by Shamir.

Installation

Before installing the library, make sure its dependencies are installed: pycryptodome, gmpy2 and setuptools. The library is written for Python >= 3.9.

You can then install the library via pip:

pip install threshold-elgamal

Getting started

The simplest way you can test out this library is by running its main function:

from threshold_elgamal import run_tc_scheme

res = run_tc_scheme(k=3, n=5, m=10)
if res is True:
    print("Success!")

You can also create your own threshold scheme manually, and then encrypt and decrypt a message of your choosing:

from threshold_elgamal import create_tc_scheme

message = 10
public_key, players, scheme = create_tc_scheme(k=3, n=5)
c1, c2 = scheme.encrypt(public_key, message=message)
decryption_shares = {player.id: player.get_decryption_share(c1) for player in players}
decrypted_msg = scheme.decrypt(c2, decryption_shares)

if decrypted_msg == message:
    print("Success!")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

threshold_elgamal-0.0.12.tar.gz (11.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

threshold_elgamal-0.0.12-py3-none-any.whl (25.2 kB view details)

Uploaded Python 3

File details

Details for the file threshold_elgamal-0.0.12.tar.gz.

File metadata

  • Download URL: threshold_elgamal-0.0.12.tar.gz
  • Upload date:
  • Size: 11.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.8.0

File hashes

Hashes for threshold_elgamal-0.0.12.tar.gz
Algorithm Hash digest
SHA256 c37401d04029a53853b73fa66588fcde63ddee6c0bb7c04154986c6df162e755
MD5 a4c61136d6b5f3de0a66494118bd024c
BLAKE2b-256 10da38bd8594f22aaa184db4797e5e790caff4ea856d745475db59b3e99e1fb0

See more details on using hashes here.

File details

Details for the file threshold_elgamal-0.0.12-py3-none-any.whl.

File metadata

File hashes

Hashes for threshold_elgamal-0.0.12-py3-none-any.whl
Algorithm Hash digest
SHA256 d8274523ae7b8ab872603a86bbd5b09c644ff827797dedcaa7f4ea810da499fd
MD5 606090152939842895bf59bc38ddb5b4
BLAKE2b-256 8f495d7dda2dccfe5f0e73a8c98a03c1e84061baad13cc35ac9fbbeae5e2a412

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page