fiatshamir

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2024 License: Apache-2.0 Imports: 3 Imported by: 212

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Settings added in v0.9.0

type Settings struct {
	Transcript     *Transcript
	Prefix         string
	BaseChallenges [][]byte
	Hash           hash.Hash
}

func WithHash added in v0.9.0

func WithHash(hash hash.Hash, baseChallenges ...[]byte) Settings

func WithTranscript added in v0.9.0

func WithTranscript(transcript *Transcript, prefix string, baseChallenges ...[]byte) Settings

type Transcript

type Transcript struct {
	// contains filtered or unexported fields
}

Transcript handles the creation of challenges for Fiat Shamir.

func NewTranscript

func NewTranscript(h hash.Hash, challengesID ...string) *Transcript

NewTranscript returns a new transcript. h is the hash function that is used to compute the challenges. challenges are the name of the challenges. The order of the challenges IDs matters.

func (*Transcript) Bind

func (t *Transcript) Bind(challengeID string, bValue []byte) error

Bind binds the challenge to value. A challenge can be binded to an arbitrary number of values, but the order in which the binded values are added is important. Once a challenge is computed, it cannot be binded to other values.

func (*Transcript) ComputeChallenge

func (t *Transcript) ComputeChallenge(challengeID string) ([]byte, error)

ComputeChallenge computes the challenge corresponding to the given name. The challenge is: * H(name || previous_challenge || binded_values...) if the challenge is not the first one * H(name || binded_values... ) if it is the first challenge

Jump to

Keyboard shortcuts

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