C# Class Goedel.Cryptography.Secret

Represents a secret key that may be split into or reformed from a collection of shares.
Show file Open project: hallambaker/Mathematical-Mesh Class Usage Examples

Public Properties

Property Type Description
Key byte[]

Public Methods

Method Description
Equals ( System obj ) : bool

Test for equality

GetHashCode ( ) : int

Hash code of the current class.

Secret ( KeyShare Shares ) : System

Recreate a secret from the specified shares.

Secret ( byte Key ) : System

Create a secret from the specified key value.

Secret ( int Bits ) : System

Create a new random secret with the specified number of bits.

Secret ( string Shares ) : System

Recreate a secret from shares specified as Base32 encoded strings.

Split ( ) : Goedel.Cryptography.KeyShare[]

Create a set of 2 key shares with a quorum of 2.

Split ( int N ) : Goedel.Cryptography.KeyShare[]

Create a set of N key shares with a quorum of N.

Split ( int N, int K ) : Goedel.Cryptography.KeyShare[]

Create a set of N key shares with a quorum of K.

Protected Methods

Method Description
Secret ( ) : System

Constructor for use in inherited classes.

Private Methods

Method Description
ArrayXOR ( byte Base, byte Mix ) : void
ArrayXOR1 ( byte Base, byte Mix ) : void
Combine ( KeyShare Shares ) : byte[]
CombineN ( KeyShare Shares ) : byte[]
CombineNK ( KeyShare Shares ) : byte[]
GetBytes ( System.Numerics.BigInteger In ) : byte[]
MakePositive ( byte Data ) : System.Numerics.BigInteger
ModInverse ( System.Numerics.BigInteger k, System.Numerics.BigInteger m ) : System.Numerics.BigInteger
PolyMod ( int x, System.Numerics.BigInteger PolyNomial, System.Numerics.BigInteger Modulus ) : System.Numerics.BigInteger

Method Details

Equals() public method

Test for equality
public Equals ( System obj ) : bool
obj System The secret to test against
return bool

GetHashCode() public method

Hash code of the current class.
public GetHashCode ( ) : int
return int

Secret() protected method

Constructor for use in inherited classes.
protected Secret ( ) : System
return System

Secret() public method

Recreate a secret from the specified shares.
public Secret ( KeyShare Shares ) : System
Shares KeyShare The shares to be recombined.
return System

Secret() public method

Create a secret from the specified key value.
public Secret ( byte Key ) : System
Key byte
return System

Secret() public method

Create a new random secret with the specified number of bits.
public Secret ( int Bits ) : System
Bits int
return System

Secret() public method

Recreate a secret from shares specified as Base32 encoded strings.
public Secret ( string Shares ) : System
Shares string The shares to be recombined.
return System

Split() public method

Create a set of 2 key shares with a quorum of 2.
public Split ( ) : Goedel.Cryptography.KeyShare[]
return Goedel.Cryptography.KeyShare[]

Split() public method

Create a set of N key shares with a quorum of N.
public Split ( int N ) : Goedel.Cryptography.KeyShare[]
N int
return Goedel.Cryptography.KeyShare[]

Split() public method

Create a set of N key shares with a quorum of K.
public Split ( int N, int K ) : Goedel.Cryptography.KeyShare[]
N int Number of key shares to create (max is 32).
K int Quorum of key shares required to reconstruct the secret.
return Goedel.Cryptography.KeyShare[]

Property Details

Key public property

The Key value
public byte[] Key
return byte[]