sssa

package module
v0.0.0-...-d37d778 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 2, 2017 License: MIT Imports: 9 Imported by: 0

README

sssa-golang

Build Status

An implementation of Shamir's Secret Sharing Algorithm in Go

Copyright (C) 2015 Alexander Scheel, Joel May, Matthew Burket  
See Contributors.md for a complete list of contributors.  
Licensed under the MIT License.  

Usage

Note: this library is for a pure implementation of SSS in Go; if you are looking for the API Library for SSSaaS, look here.

sssa.Create(minimum int, shares int, raw string) - creates a set of shares

sssa.Combine(shares []string) - combines shares into secret

For more detailed documentation, check out docs/sssa.md.

Contributing

We welcome pull requests, issues, security advice on this library, or other contributions you feel are necessary. Feel free to open an issue to discuss any questions you have about this library.

This is the reference implementation for all other SSSA projects. Please make sure all tests pass before submitting a pull request. In particular, go test will run all internal tests and the go-libtest suite's tests should be run against the changes before submission.

For security issues, send a GPG-encrypted email to alexander.m.scheel@gmail.com with public key 0xBDC5F518A973035E.

Documentation

Index

Constants

View Source
const (
	DefaultPrimeStr = "115792089237316195423570985008687907853269984665640564039457584007913129639747"
)

Variables

View Source
var (
	ErrCannotRequireMoreShares = errors.New("cannot require more shares then existing")
	ErrOneOfTheSharesIsInvalid = errors.New("one of the shares is invalid")
)

Functions

func Combine

func Combine(shares []string) (string, error)

*

  • 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

func Create(minimum int, shares int, raw string) ([]string, error)

*

  • 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

func IsValidShare(candidate string) bool

*

  • 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)

*

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL