maurer09

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidArgument indicates missing or inconsistent inputs.
	ErrInvalidArgument = errs.New("invalid argument")
	// ErrValidationFails indicates malformed or invalid data.
	ErrValidationFails = errs.New("validation failed")
	// ErrFailed signals unrecoverable error.
	ErrFailed = errs.New("validation failed")
	// ErrVerificationFailed signals failed proof verification.
	ErrVerificationFailed = errs.New("verification failed")
)

Functions

This section is empty.

Types

type Commitment

type Commitment[I algebra.GroupElement[I]] struct {
	A I `cbor:"a"`
}

Commitment holds the prover commitment.

func (*Commitment[I]) Bytes

func (c *Commitment[I]) Bytes() []byte

Bytes encodes the commitment.

func (*Commitment[I]) Value

func (c *Commitment[I]) Value() I

Value returns the commitment group element.

type MaurerOption

type MaurerOption[I algebra.GroupElement[I], P algebra.GroupElement[P]] func(protocol *Protocol[I, P])

MaurerOption configures the Maurer09 protocol.

func WithImageScalarMul

func WithImageScalarMul[I algebra.GroupElement[I], P algebra.GroupElement[P]](scalarMul func(I, []byte) I) MaurerOption[I, P]

WithImageScalarMul overrides the scalar multiplication in the image group.

func WithPreImageScalarMul

func WithPreImageScalarMul[I algebra.GroupElement[I], P algebra.GroupElement[P]](scalarMul func(P, []byte) P) MaurerOption[I, P]

WithPreImageScalarMul overrides the scalar multiplication in the pre-image group.

type Protocol

type Protocol[I algebra.GroupElement[I], P algebra.GroupElement[P]] struct {
	// contains filtered or unexported fields
}

Protocol implements the Maurer09 sigma protocol.

func NewProtocol

func NewProtocol[I algebra.GroupElement[I], P algebra.GroupElement[P]](
	challengeByteLen int,
	soundnessError uint,
	name sigma.Name,
	imageGroup algebra.FiniteGroup[I],
	preImageGroup algebra.FiniteGroup[P],
	oneWayHomomorphism sigma.OneWayHomomorphism[I, P],
	anchor sigma.Anchor[I, P],
	prng io.Reader,
	options ...MaurerOption[I, P],
) (*Protocol[I, P], error)

NewProtocol constructs a Maurer09 protocol instance.

func (*Protocol[I, P]) Anchor

func (p *Protocol[I, P]) Anchor() sigma.Anchor[I, P]

Anchor returns the protocol anchor.

func (*Protocol[I, P]) ComputeProverCommitment

func (p *Protocol[I, P]) ComputeProverCommitment(_ *Statement[I], _ *Witness[P]) (*Commitment[I], *State[P], error)

ComputeProverCommitment creates the Maurer09 commitment and state.

func (*Protocol[I, P]) ComputeProverResponse

func (p *Protocol[I, P]) ComputeProverResponse(_ *Statement[I], witness *Witness[P], _ *Commitment[I], state *State[P], challengeBytes sigma.ChallengeBytes) (*Response[P], error)

ComputeProverResponse computes the Maurer09 response.

func (*Protocol[I, P]) Extract

func (p *Protocol[I, P]) Extract(x *Statement[I], a *Commitment[I], ei []sigma.ChallengeBytes, zi []*Response[P]) (*Witness[P], error)

Extract derives the witness from two valid transcripts.

func (*Protocol[I, P]) GetChallengeBytesLength

func (p *Protocol[I, P]) GetChallengeBytesLength() int

GetChallengeBytesLength returns the challenge size in bytes.

func (*Protocol[I, P]) ImageGroup

func (p *Protocol[I, P]) ImageGroup() algebra.FiniteGroup[I]

ImageGroup returns the protocol image group.

func (*Protocol[I, P]) Name

func (p *Protocol[I, P]) Name() sigma.Name

Name returns the protocol name.

func (*Protocol[I, P]) Phi

func (p *Protocol[I, P]) Phi() sigma.OneWayHomomorphism[I, P]

Phi returns the protocol one-way homomorphism.

func (*Protocol[I, P]) PreImageGroup

func (p *Protocol[I, P]) PreImageGroup() algebra.FiniteGroup[P]

PreImageGroup returns the protocol pre-image group.

func (*Protocol[I, P]) RunSimulator

func (p *Protocol[I, P]) RunSimulator(statement *Statement[I], challengeBytes sigma.ChallengeBytes) (*Commitment[I], *Response[P], error)

RunSimulator simulates a Maurer09 transcript for a given challenge.

func (*Protocol[G, S]) SoundnessError

func (p *Protocol[G, S]) SoundnessError() uint

SoundnessError returns the protocol soundness error.

func (*Protocol[I, P]) SpecialSoundness

func (*Protocol[I, P]) SpecialSoundness() uint

SpecialSoundness returns the protocol special soundness parameter.

func (*Protocol[I, P]) ValidateStatement

func (p *Protocol[I, P]) ValidateStatement(statement *Statement[I], witness *Witness[P]) error

ValidateStatement checks statement/witness consistency.

func (*Protocol[I, P]) Verify

func (p *Protocol[I, P]) Verify(statement *Statement[I], commitment *Commitment[I], challengeBytes sigma.ChallengeBytes, response *Response[P]) error

Verify checks a Maurer09 proof response.

type Response

type Response[P algebra.GroupElement[P]] struct {
	Z P `cbor:"z"`
}

Response holds the prover response.

func (*Response[P]) Bytes

func (c *Response[P]) Bytes() []byte

Bytes encodes the response.

func (*Response[P]) Value

func (c *Response[P]) Value() P

Value returns the response group element.

type State

type State[P algebra.GroupElement[P]] struct {
	S P `cbor:"s"`
}

State stores the prover's internal state.

func (*State[P]) Bytes

func (s *State[P]) Bytes() []byte

Bytes encodes the state.

func (*State[P]) Value

func (s *State[P]) Value() P

Value returns the state group element.

type Statement

type Statement[I algebra.GroupElement[I]] struct {
	X I `cbor:"x"`
}

Statement holds the Maurer09 statement.

func (*Statement[I]) Bytes

func (x *Statement[I]) Bytes() []byte

Bytes encodes the statement.

func (*Statement[I]) Value

func (x *Statement[I]) Value() I

Value returns the statement group element.

type Witness

type Witness[P algebra.GroupElement[P]] struct {
	W P `cbor:"w"`
}

Witness holds the Maurer09 witness.

func (*Witness[P]) Bytes

func (w *Witness[P]) Bytes() []byte

Bytes encodes the witness.

func (*Witness[P]) Value

func (w *Witness[P]) Value() P

Value returns the witness group element.

Jump to

Keyboard shortcuts

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