C# Class MpcLib.SecretSharing.ShamirSharing

Implemenets the threshold secret sharing scheme based on Adi Shamir's method.
Datei anzeigen Open project: mahdiz/mpclib Class Usage Examples

Public Methods

Method Description
CalculateRandomShare ( Zp myShare, IList polyUpdate ) : Zp

The i-th user gets a Qj(i) List from users, each user j calculated Qj(i) - the j element in the List

CheckSharedSecrets ( Zp secret, int numberOfPlayers, int polynomDeg, int prime ) : bool
DetailedShare ( Zp secret, int numPlayers, int polynomDeg ) : ShareDetails

Evaluates the shared secrets of secret with polynom of degree t and numberOfPlayers players.

GetRandomizedShares ( int numPlayers, int polynomDeg, int prime ) : IList

Creates a random poynomial Qj(x), for the j player, and creates a list of elements, such that the i-th element is Qj(i)

GetRandomizedSharesByzantineCase ( int numPlayers, int polynomDeg, int prime ) : IList

Creates a random poynomial Qj(x) ,for the j player,and creates a list of elements, such that the i-th element is Qj(i)

PrimitiveShare ( Zp secret, int numPlayers, int polynomDeg ) : IList
Recombine ( IList sharedSecrets, int polynomDeg, int prime ) : Zp
Recombine ( IList sharedSecrets, int polyDeg, int prime, bool usePrimitiveRecombine ) : Zp

Recombines (interpolate) the secret from secret shares.

Share ( Zp secret, int numPlayers, int polyDeg ) : IList

Calculates the shares of a secret with polynomial of degree t and numPlayers players.

Share ( Zp secret, int numPlayers, int polyDeg, IList &coeffs ) : IList

Calculates the shares of a secret with polynomial of degree t and numPlayers players. The method also returns the array of coefficients of the polynomial.

SimpleRecombine ( IList sharedSecrets, int polyDeg, int prime ) : Zp

Private Methods

Method Description
Share ( Zp secret, int numPlayers, int polynomDeg, bool usePrimitiveShare, IList &coeffs ) : IList

Evaluates the shares of secret with polynomial of degree 'polynomDeg' and 'numPlayers' players.

TruncateVector ( Zp vector, int toSize ) : Zp[]

Method Details

CalculateRandomShare() public static method

The i-th user gets a Qj(i) List from users, each user j calculated Qj(i) - the j element in the List
public static CalculateRandomShare ( Zp myShare, IList polyUpdate ) : Zp
myShare Zp
polyUpdate IList
return Zp

CheckSharedSecrets() public static method

public static CheckSharedSecrets ( Zp secret, int numberOfPlayers, int polynomDeg, int prime ) : bool
secret Zp
numberOfPlayers int
polynomDeg int
prime int
return bool

DetailedShare() public static method

Evaluates the shared secrets of secret with polynom of degree t and numberOfPlayers players.
public static DetailedShare ( Zp secret, int numPlayers, int polynomDeg ) : ShareDetails
secret Zp
numPlayers int
polynomDeg int
return ShareDetails

GetRandomizedShares() public static method

Creates a random poynomial Qj(x), for the j player, and creates a list of elements, such that the i-th element is Qj(i)
public static GetRandomizedShares ( int numPlayers, int polynomDeg, int prime ) : IList
numPlayers int
polynomDeg int
prime int
return IList

GetRandomizedSharesByzantineCase() public static method

Creates a random poynomial Qj(x) ,for the j player,and creates a list of elements, such that the i-th element is Qj(i)
public static GetRandomizedSharesByzantineCase ( int numPlayers, int polynomDeg, int prime ) : IList
numPlayers int
polynomDeg int
prime int
return IList

PrimitiveShare() public static method

public static PrimitiveShare ( Zp secret, int numPlayers, int polynomDeg ) : IList
secret Zp
numPlayers int
polynomDeg int
return IList

Recombine() public static method

public static Recombine ( IList sharedSecrets, int polynomDeg, int prime ) : Zp
sharedSecrets IList
polynomDeg int
prime int
return Zp

Recombine() public static method

Recombines (interpolate) the secret from secret shares.
public static Recombine ( IList sharedSecrets, int polyDeg, int prime, bool usePrimitiveRecombine ) : Zp
sharedSecrets IList
polyDeg int
prime int
usePrimitiveRecombine bool
return Zp

Share() public static method

Calculates the shares of a secret with polynomial of degree t and numPlayers players.
public static Share ( Zp secret, int numPlayers, int polyDeg ) : IList
secret Zp
numPlayers int
polyDeg int
return IList

Share() public static method

Calculates the shares of a secret with polynomial of degree t and numPlayers players. The method also returns the array of coefficients of the polynomial.
public static Share ( Zp secret, int numPlayers, int polyDeg, IList &coeffs ) : IList
secret Zp
numPlayers int
polyDeg int
coeffs IList
return IList

SimpleRecombine() public static method

public static SimpleRecombine ( IList sharedSecrets, int polyDeg, int prime ) : Zp
sharedSecrets IList
polyDeg int
prime int
return Zp