shamir

package
v0.0.0-...-0c359fc Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2021 License: MPL-2.0, MPL-2.0 Imports: 5 Imported by: 0

README

Implementation of Shamir's Secret Sharing taken from Hashicorp Vault

Modified to reduce external dependencies (errwrap).

Documentation

Index

Constants

View Source
const (
	// ShareOverhead is the byte size overhead of each share
	// when using Split on a secret. This is caused by appending
	// a one byte tag to the share.
	ShareOverhead = 1
)

Variables

This section is empty.

Functions

func Combine

func Combine(parts [][]byte) ([]byte, error)

Combine is used to reverse a Split and reconstruct a secret once a `threshold` number of parts are available.

func Split

func Split(secret []byte, parts, threshold int) ([][]byte, error)

Split takes an arbitrarily long secret and generates a `parts` number of shares, `threshold` of which are required to reconstruct the secret. The parts and threshold must be at least 2, and less than 256. The returned shares are each one byte longer than the secret as they attach a tag used to reconstruct the secret.

func ValidateSplit

func ValidateSplit(parts, threshold int) error

ValidateSplit checks that the `parts` and `threshold` are set to valid values. (modified from vault source to allow checking args prior to the entry of the secret)

Types

This section is empty.

Jump to

Keyboard shortcuts

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