Documentation ¶
Overview ¶
Package shamirssgo
- is a Shamir's Secret Sharing implementation in Go
- Copyright (C) 2019 Prahesa Kusuma Setia (prahesa at yahoo dot com) *
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version. *
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details. *
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
Package shamir ¶
@author: xwc1125 @date: 2020/6/6 https://github.com/SSSaaS/sssa-golang
Package shamir ¶
@author: xwc1125 @date: 2020/6/6
Index ¶
Constants ¶
View Source
const (
DefaultPrimeStr = "115792089237316195423570985008687907853269984665640564039457584007913129639747"
)
Variables ¶
View Source
var ()
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 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 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 ReconstructSecret ¶
ReconstructSecret is used to reconstruct the original secret based on the shares given in the sharesMap parameter. The number of shares given need to be greater than or equal to the threshold, otherwise the result of this function is undefined
Types ¶
type ShamirSecret ¶
type ShamirSecret struct {
// contains filtered or unexported fields
}
ShamirSecret is a type struct of the package
Click to show internal directories.
Click to hide internal directories.