shamir

package
v5.0.0-...-c6008c3 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package shamir is Shamir’s Secret Sharing is a method for dividing a secret into multiple parts and distributing those parts among different participants. This ensures that only authorized parties can access the secret.

The method involves randomly generating n parts, each of which is completely independent of the other parts and contains no information about the original secret. An integer threshold k is specified such that the original secret can only be reconstructed when k or more parts are combined together.

Each participant holds one part of the secret and can only access the original secret when they combine their part with at least k-1 other parts. This method provides high security, as even if some of the participants are compromised, they will only have access to a partial key, and cannot reconstruct the original secret.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Combine

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

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

the key and value are must as same as splited result.

func Split

func Split(secret []byte, total, threshold int) (members map[byte][]byte, err error)

Split takes an arbitrarily long secret and generates a `total` number of shares, `threshold` of which are required to reconstruct the secret. The total 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.

the key and values of members are both important to combine.

Types

This section is empty.

Jump to

Keyboard shortcuts

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