Documentation ¶
Index ¶
- Constants
- Variables
- func Combine(shares []string) (string, error)
- func Combine256Bit(shares []string) (*big.Int, error)
- func CombineECDSAPubkey(shares []string) (*ecdsa.PublicKey, error)
- func Create(minimum int, shares int, raw string) ([]string, error)
- func Create256Bit(minimum int, shares int, raw *big.Int) ([]string, []*big.Int, []*big.Int, error)
- func ExtractPrivateShare(privshare string) *ecdsa.PrivateKey
- func GenerateCommitteePublicKey(polynomials [][]*ecdsa.PublicKey) *ecdsa.PublicKey
- func GeneratePrivKey(key *big.Int) *ecdsa.PrivateKey
- func GenerateSssaKey(shares []string) *big.Int
- func IsValidShare(candidate string) bool
- func IsValidShare256Bit(candidate string) bool
- func ScanPubSharesA1(bA *ecdsa.PublicKey, S *ecdsa.PublicKey) ecdsa.PublicKey
- func ToECDSAPubArray(privs []*big.Int) []*ecdsa.PublicKey
- func VerifyCreatedAndPolynomial(shares []string, pubkeyArray []*ecdsa.PublicKey) bool
- func VerifyPolynomial(share string, pubkeyArray []*ecdsa.PublicKey) bool
- type PrivateShare
Constants ¶
View Source
const (
DefaultPrimeStr = "115792089237316195423570985008687907852837564279074904382605163141518161494337"
)
*
- DefaultPrimeStr is based on encryption curve, equals to the 'N'
- The current curve is secp256k1
*
Variables ¶
View Source
var ( ErrInvalidPubkey = errors.New("Invalid publick key") )
Functions ¶
func Combine ¶
*
- Takes a string array of shares encoded in base64 created via Shamir's
- Algorithm; each string must be of equal length of a multiple of 88 characters
- as a single 88 character share is a pair of 256-bit numbers (x, y). *
- Note: the polynomial will converge if the specified minimum number of shares
- or more are passed to this function. Passing thus does not affect it
- Passing fewer however, simply means that the returned secret is wrong.
*
func Combine256Bit ¶
*
- Takes a string array of shares encoded in base64 created via Shamir's
- Algorithm; each string must be of equal length of a multiple of 88 characters
- as a single 88 character share is a pair of 256-bit numbers (x, y). *
- Note: the polynomial will converge if the specified minimum number of shares
- or more are passed to this function. Passing thus does not affect it
- Passing fewer however, simply means that the returned secret is wrong.
*
func CombineECDSAPubkey ¶
*
- Takes a string array of shares encoded in base64 created via Shamir's
- Algorithm; each string must be of equal length of a multiple of 88 characters
- as a single 88 character share is a pair of 256-bit numbers (x, y). *
- Note: the polynomial will converge if the specified minimum number of shares
- or more are passed to this function. Passing thus does not affect it
- Passing fewer however, simply means that the returned secret is wrong.
*
func Create ¶
*
- Returns a new arary of secret shares (encoding x,y pairs as base64 strings)
- created by Shamir's Secret Sharing Algorithm requring a minimum number of
- share to recreate, of length shares, from the input secret raw as a string
*
func Create256Bit ¶
*
- Returns a new array of secret shares and polynomial
- created by Shamir's Secret Sharing Algorithm requring a minimum number of
- share to recreate, of length shares, from the input secret raw as a big.Int
*
func ExtractPrivateShare ¶
func ExtractPrivateShare(privshare string) *ecdsa.PrivateKey
Extract private share from string
func GenerateCommitteePublicKey ¶
Generate multi-sssa public key from public key shares
func GeneratePrivKey ¶
func GeneratePrivKey(key *big.Int) *ecdsa.PrivateKey
func GenerateSssaKey ¶
Generate multi-sssa private key from key shares
func IsValidShare ¶
*
- Takes in a given string to check if it is a valid secret *
- Requirements:
- Length multiple of 88
- Can decode each 44 character block as base64 *
- Returns only success/failure (bool)
*
func IsValidShare256Bit ¶
*
- Takes in a given string to check if it is a valid secret *
- Requirements:
- Length 88
- Can decode each 44 character block as base64 *
- Returns only success/failure (bool)
*
func ScanPubSharesA1 ¶
GenerateA1 generate one pulic key of AB account A1=[hash([b]A)]G+S
func ToECDSAPubArray ¶
Generate public key array from a private big.int keys array
func VerifyCreatedAndPolynomial ¶
*
*Returns the created shares and polynomials whether match * For: f(x) = a0 + a1x + a2x^2 + ... + a(k-1)x^k-1 * If get a point (m, f(m)) on line * Should have * f(m)G = a0G + m * a1G + ... + m^(k-1) * a(k-1)G * The input share is m + f(m)G Shares Array, the pubkeyArray is the Polynomial Pubkey
*
func VerifyPolynomial ¶
*
*Returns the created shares and polynomials whether match * For: f(x) = a0 + a1x + a2x^2 + ... + a(k-1)x^k-1 * If get a point (m, f(m)) on line * Should have * f(m)G = a0G + m * a1G + ... + m^(k-1) * a(k-1)G * The input share is m + f(m)G share string, the pubkeyArray is the Polynomial Pubkey
*
Types ¶
type PrivateShare ¶
type PrivateShare struct {}
Click to show internal directories.
Click to hide internal directories.