ThresholdElGamal
- class threshold_elgamal.elgamal.ThresholdElGamal(k=3, n=5, length=2048)[source]
Threshold scheme for ElGamal cryptosystem.
- Parameters
k (int) – Threshold.
n (int) – Total number of players.
length (int) – Length of prime number p.
- decrypt(c2, decryption_shares)[source]
Runs a distributed decryption algorithm using the ElGamal cryptosystem.
- Parameters
c2 (str) – Encryption part c2.
decryption_shares (dict) – Decryption shares.
- Returns
Decrypted message.
- Return type
int
- threshold_elgamal.elgamal.create_tc_scheme(k, n, length=2048)[source]
Creates an ElGamal threshold scheme.
- Parameters
length (int) – Length of prime number p used in the scheme.
k (int) – Threshold.
n (int) – Total number of players.
- Returns
Public key, list of players, scheme object.
- Return type
tuple
- threshold_elgamal.elgamal.run_tc_scheme(k, n, m, length=2048)[source]
Runs an ElGamal threshold scheme.
- Parameters
length (int) – Length of prime number p used as modulo in the scheme.
k (int) – Threshold.
n (int) – Total number of players.
m (int) – Message.
- Returns
The validity of the run scheme.
- Return type
bool