Version: v0.14.0 Latest Latest

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

Go to latest
Published: Dec 21, 2021 License: Apache-2.0 Imports: 4 Imported by: 1




Secure comparison result.

View Source
const (
	COMPARE_MATCH     = Match

Secure comparison result.

Deprecated: Since 0.11. Use "compare.Match..." constants instead.


View Source
var (
	ErrAppendSecret      = errors.New("failed to append secret")
	ErrCreateComparator  = errors.New("failed to create comparator object")
	ErrDestroyComparator = errors.New("failed to destroy comparator object")
	ErrProtocolData      = errors.New("failed to get protocol data")
	ErrProtocolDataSize  = errors.New("failed to get protocol data size")
	ErrNoResult          = errors.New("failed to get result")
	ErrMissingSecret     = errors.NewWithCode(errors.InvalidParameter, "empty secret for Secure Comparator")
	ErrMissingData       = errors.NewWithCode(errors.InvalidParameter, "empty comparison message for Secure Comparator")
	ErrOutOfMemory       = errors.NewWithCode(errors.NoMemory, "Secure Comparator cannot allocate enough memory")
	// Deprecated: Since 0.14. Use ErrOutOfMemory instead.
	ErrOverflow = ErrOutOfMemory

Errors returned by Secure Comparator.


This section is empty.


type SecureCompare

type SecureCompare struct {
	// contains filtered or unexported fields

SecureCompare is an interactive protocol for two parties that compares whether they share the same secret or not.

func New

func New() (*SecureCompare, error)

New prepares a new secure comparison.

func (*SecureCompare) Append

func (sc *SecureCompare) Append(secret []byte) error

Append adds data to be compared.

func (*SecureCompare) Begin

func (sc *SecureCompare) Begin() ([]byte, error)

Begin initiates secure comparison and returns data to be sent to the peer.

func (*SecureCompare) Close

func (sc *SecureCompare) Close() error

Close destroys Secure Comparator.

func (*SecureCompare) Proceed

func (sc *SecureCompare) Proceed(data []byte) ([]byte, error)

Proceed continues the comparison process with peer data and returns a reply. Comparison is complete when this method returns nil successfully.

func (*SecureCompare) Result

func (sc *SecureCompare) Result() (int, error)

Result returns the result of the comparison.

Source Files

Jump to

Keyboard shortcuts

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