Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ()
View Source
var (
EmptyMessageError = errors.New("The message to be signed should not be empty")
)
Functions ¶
func ComplexSecretRetrieve ¶
Shamir's Secret Sharing algorithm, can be considered as: A way to split a secret to W shares, the secret can only be retrieved if more than T(T <= W) shares are combined together.
This is the retrieve process:
- Decode each share i.e. the byte slice to a (x, y) pair
- Use lagrange interpolation formula, take the (x, y) pairs as input points to compute a polynomial f(x) which is able to match all the given points.
- Give x = 0, then the secret number S can be computed
- Now decode number S, then the secret is retrieved
func ComplexSecretSplit ¶
func ComplexSecretSplit(totalShareNumber, minimumShareNumber int, secret []byte) (shares map[int]*big.Int, err error)
Shamir's Secret Sharing algorithm, can be considered as: A way to split a secret to W shares, the secret can only be retrieved if more than T(T <= W) shares are combined together.
This is the split process:
- Encode the secret to a number S
- Choose a lot of random numbers as coefficients, in order to make a random polynomials F(x) of degree T-1, the variable is X, the const(x-intercept) is S
- For this polynomial, Give x diffent values, for example, x++ each time, then compute y = F(x)
- So we get W shares, which are (x, y) pairs
- Now encode each pair to a byte slice
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.