distributed_keygen.shamir_secret_sharing_integers module

Utility for Shamir secret sharing over the integers.

class distributed_keygen.shamir_secret_sharing_integers.IntegerShares(shamir_sss, shares, degree, scaling)[source]

Bases: object

Class that keeps track of the shares for a certain value that is secret shared over the integers.

__add__(other)[source]

Add the shares belonging to the two given IntegerShares values together.

Parameters:

other (IntegerShares) – Shares to be added to these shares.

Raises:

ValueError – In case a different secret sharing scheme was used.

Return type:

IntegerShares

Returns:

New IntegerShares object where the shares have been added together.

__mul__(other)[source]

Multiply the shares belonging to the two given IntegerShares values together. Only possible when both schemes are the same.

Parameters:

other (IntegerShares) – Shares to be multiplied with these shares.

Return type:

IntegerShares

Returns:

New IntegerShares object where the shares have been multiplied together.

__rmul__(other)[source]

Multiply the shares belonging to this value with a given scalar integer or ShamirShares object.

Parameters:

other (Any) – ShamirShares or scalar to be multiplied with these shares.

Return type:

Any

Returns:

New IntegerShares object where the shares have been multiplied together.

reconstruct_secret(modulus=0)[source]

Function that uses the shares from other parties to reconstruct the secret

Parameters:

modulus (int) – the modulus to use

Raises:

ValueError – In case not enough shares are present to reconstruct the secret.

Return type:

int

Returns:

original secret

serialize()[source]

Serialization function

Return type:

Dict[str, Dict[str, Union[int, Dict[int, int], Dict[str, Dict[str, int]]]]]

Returns:

json object containing the necessary information to deserialize

class distributed_keygen.shamir_secret_sharing_integers.ShamirSecretSharingIntegers(kappa=40, max_int=5, number_of_parties=10, polynomial_degree=4)[source]

Bases: object

Class with Shamir Secret sharing functionality over the integers

__init__(kappa=40, max_int=5, number_of_parties=10, polynomial_degree=4)[source]

Initialize a secret sharing over the integers

Parameters:
  • kappa (int) – statistical security parameter

  • max_int (int) – Value that together with kappa and number_of_parties determines the interval from which polynomial coefficients are randomly sampled. In general, the Paillier modulus is used for max.

  • number_of_parties (int) – number of shares that need to be created for each sharing

  • polynomial_degree (int) – degree of polynomials used to share secrets

serialize()[source]

Serialization function

Return type:

Dict[str, Dict[str, int]]

Returns:

json object containing the necessary information to deserialize

share_secret(secret)[source]

Function that creates shares of a value for each party

Parameters:

secret (int) – secret to be shared

Return type:

IntegerShares

Returns:

sharing of the secret

class distributed_keygen.shamir_secret_sharing_integers.Shares(partial_decryption=<factory>, p=<factory>, q=<factory>, n=<factory>, biprime=<factory>, v=<factory>, lambda_=<factory>, beta=<factory>, secret_key=<factory>)[source]

Bases: object

Shares contains all shares of this party. Every subclass contains an object for that element, such as \(p\) or \(q\). These objects contain up to two entries: “additive” and “shares”, in “additive”, the local additive share of that element is stored, in “shares”, the shamir shares of the local additive share are stored.

class Beta(additive=0, shares=<factory>)[source]

Bases: object

Shares of \(\beta\).

additive: int = 0
shares: Dict[int, int]
class Biprime(additive=0, shares=<factory>)[source]

Bases: object

Shares of the used biprime.

additive: int = 0
shares: Dict[int, int]
class Lambda(additive=0, shares=<factory>)[source]

Bases: object

Shares of \(\lambda\).

additive: int = 0
shares: Dict[int, int]
class N(shares=<factory>)[source]

Bases: object

Shares of \(n\).

shares: Dict[int, int]
class P(additive=0, shares=<factory>)[source]

Bases: object

Shares of \(p\).

additive: int = 0
shares: Dict[int, int]
class PartialDecryption(shares=<factory>)[source]

Bases: object

Partial decryption containing shares of at least this party.

shares: Dict[int, int]
class Q(additive=0, shares=<factory>)[source]

Bases: object

Shares of \(q\).

additive: int = 0
shares: Dict[int, int]
class SecretKey(additive=0, shares=<factory>)[source]

Bases: object

Shares of the secret key.

additive: int = 0
shares: Dict[int, int]
class V(additive=0, shares=<factory>)[source]

Bases: object

Shares of \(v\).

additive: int = 0
shares: Dict[int, int]
beta: Beta
biprime: Biprime
lambda_: Lambda
n: N
p: P
partial_decryption: PartialDecryption
q: Q
secret_key: SecretKey
v: V