common

package
v0.0.0-...-b1e8a79 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2024 License: Apache-2.0, MIT Imports: 7 Imported by: 7

Documentation

Index

Constants

View Source
const VectorLength = 256

VectorLength is the number of elements in the vector. This value is fixed. Note that this means that the degree of the polynomial is one less than this value.

Variables

This section is empty.

Functions

func PowersOf

func PowersOf(x fr.Element, degree int) []fr.Element

Returns powers of x from 0 to degree-1 <1, x, x^2, x^3, x^4,...,x^(degree-1)> TODO This method is used in two places; one is to evaluate a polynomial (test), and the other is to TODO compute powers of challenges. TODO the first one we can use the bls package for TODO The second we _could_ just multiply on each iteration, (depends on how readable it is)

func ReadPoint

func ReadPoint(r io.Reader) (*banderwagon.Element, error)

func ReadScalar

func ReadScalar(r io.Reader) (*fr.Element, error)

Types

type Transcript

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

The transcript is used to create challenge scalars. See: Fiat-Shamir

func NewTranscript

func NewTranscript(label string) *Transcript

func (*Transcript) AppendMessage

func (t *Transcript) AppendMessage(message []byte, label []byte)

func (*Transcript) AppendPoint

func (t *Transcript) AppendPoint(point *banderwagon.Element, label []byte)

Appends a Point to the transcript

Compresses the Point into a 32 byte slice, then appends it to the state

func (*Transcript) AppendScalar

func (t *Transcript) AppendScalar(scalar *fr.Element, label []byte)

Appends a Scalar to the transcript

Converts the scalar to 32 bytes, then appends it to the state

func (*Transcript) ChallengeScalar

func (t *Transcript) ChallengeScalar(label []byte) fr.Element

Computes a challenge based off of the state of the transcript

Hash the transcript state, then reduce the hash modulo the size of the scalar field

Note that calling the transcript twice, will yield two different challenges

func (*Transcript) DomainSep

func (t *Transcript) DomainSep(label []byte)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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