Player
- class threshold_elgamal.player.Player(i, params)[source]
Player that takes part in a threshold ElGamal cryptosystem.
- Parameters
i (int) – Player identifier.
params (dict) – Parameters of the threshold scheme: primes p and q, generators g and h, total number of players n and threshold k.
- check_pk_commits(commits, failed_shares)[source]
Checks commits for the construction of the public key. If any of the commits fail, the received share of that player is returned and used later when constructing the public key without said player’s involvement.
- Parameters
commits (dict) – Commitments.
failed_shares (dict) – Dictionary of received shares of players for whom the check failed. Used later while constructing the public key.
Checks commitments for the shares and complains if the check fails.
- Parameters
commits (dict) – Commitments.
players (list) – List of players.
- commit()[source]
Creates commitments for coefficients of the generated random polynomials.
- Returns
Commitments.
- Rtype list
- commit_pk()[source]
Generates commitments for the construction of the public key.
- Returns
Commitments.
- Return type
list
- complain(player)[source]
Processes complains to player. If the player received more than t = k-1 complaints, they are disqualified.
- Parameters
player (Player) – Player who receives the complaint.
Constructs decryption share used later in decryption of the message.
- Parameters
c1 (gmpy2.mpz) – Encryption part c1.
- construct_pk(commits)[source]
Constructs public key from public key commitments.
- Parameters
commits (dict) – Commitments.
Fetches the decryption share.
- Parameters
c1 (gmpy2.mpz) – Encryption part c1.
- Returns
Decryption share.
- Return type
gmpy2.mpz
Sends a pair of shares to each of the players.
- Parameters
players (list) – List of players (including self).