gnark

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2024 License: Apache-2.0, MIT, MPL-2.0 Imports: 12 Imported by: 0

README

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	G1 kyber.Group = &groupBls{name: "bls12-381.G1", newPoint: func() kyber.Point { return new(G1Elt).Null() }}
	G2 kyber.Group = &groupBls{name: "bls12-381.G2", newPoint: func() kyber.Point { return new(G2Elt).Null() }}
	GT kyber.Group = &groupBls{name: "bls12-381.GT", newPoint: func() kyber.Point { return new(GTElt).Null() }}
)

Functions

This section is empty.

Types

type G1Elt

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

G1Elt is a wrapper around a G1 point on the BLS12-381 Gnark curve.

func (*G1Elt) Add

func (p *G1Elt) Add(a, b kyber.Point) kyber.Point

func (*G1Elt) Base

func (p *G1Elt) Base() kyber.Point

func (*G1Elt) Clone

func (p *G1Elt) Clone() kyber.Point

func (*G1Elt) Data

func (p *G1Elt) Data() ([]byte, error)

func (*G1Elt) Embed

func (p *G1Elt) Embed(_ []byte, _ cipher.Stream) kyber.Point

func (*G1Elt) EmbedLen

func (p *G1Elt) EmbedLen() int

func (*G1Elt) Equal

func (p *G1Elt) Equal(p2 kyber.Point) bool

func (*G1Elt) Hash

func (p *G1Elt) Hash(msg []byte) kyber.Point

func (*G1Elt) Hash2

func (p *G1Elt) Hash2(msg, dst []byte) kyber.Point

func (*G1Elt) IsInCorrectGroup

func (p *G1Elt) IsInCorrectGroup() bool

func (*G1Elt) MarshalBinary

func (p *G1Elt) MarshalBinary() (data []byte, err error)

MarshalBinary returns a compressed point, without any domain separation tag information

func (*G1Elt) MarshalSize

func (p *G1Elt) MarshalSize() int

func (*G1Elt) MarshalTo

func (p *G1Elt) MarshalTo(w io.Writer) (int, error)

MarshalTo writes a compressed point to the Writer, without any domain separation tag information

func (*G1Elt) Mul

func (p *G1Elt) Mul(s kyber.Scalar, q kyber.Point) kyber.Point

func (*G1Elt) Neg

func (p *G1Elt) Neg(a kyber.Point) kyber.Point

func (*G1Elt) Null

func (p *G1Elt) Null() kyber.Point

func (*G1Elt) Pick

func (p *G1Elt) Pick(rand cipher.Stream) kyber.Point

func (*G1Elt) Set

func (p *G1Elt) Set(p2 kyber.Point) kyber.Point

func (*G1Elt) String

func (p *G1Elt) String() string

func (*G1Elt) Sub

func (p *G1Elt) Sub(a, b kyber.Point) kyber.Point

func (*G1Elt) UnmarshalBinary

func (p *G1Elt) UnmarshalBinary(data []byte) error

UnmarshalBinary populates the point from a compressed point representation.

func (*G1Elt) UnmarshalFrom

func (p *G1Elt) UnmarshalFrom(r io.Reader) (int, error)

UnmarshalFrom populates the point from a compressed point representation read from the Reader.

type G2Elt

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

G2Elt is a wrapper around the Gnark G2 point type.

func (*G2Elt) Add

func (p *G2Elt) Add(a, b kyber.Point) kyber.Point

func (*G2Elt) Base

func (p *G2Elt) Base() kyber.Point

func (*G2Elt) Clone

func (p *G2Elt) Clone() kyber.Point

func (*G2Elt) Data

func (p *G2Elt) Data() ([]byte, error)

func (*G2Elt) Embed

func (p *G2Elt) Embed(_ []byte, _ cipher.Stream) kyber.Point

func (*G2Elt) EmbedLen

func (p *G2Elt) EmbedLen() int

func (*G2Elt) Equal

func (p *G2Elt) Equal(p2 kyber.Point) bool

func (*G2Elt) Hash

func (p *G2Elt) Hash(msg []byte) kyber.Point

func (*G2Elt) Hash2

func (p *G2Elt) Hash2(msg, dst []byte) kyber.Point

func (*G2Elt) IsInCorrectGroup

func (p *G2Elt) IsInCorrectGroup() bool

func (*G2Elt) MarshalBinary

func (p *G2Elt) MarshalBinary() (data []byte, err error)

MarshalBinary returns a compressed point, without any domain separation tag information

func (*G2Elt) MarshalSize

func (p *G2Elt) MarshalSize() int

func (*G2Elt) MarshalTo

func (p *G2Elt) MarshalTo(w io.Writer) (int, error)

MarshalTo writes a compressed point to the Writer, without any domain separation tag information

func (*G2Elt) Mul

func (p *G2Elt) Mul(s kyber.Scalar, q kyber.Point) kyber.Point

func (*G2Elt) Neg

func (p *G2Elt) Neg(a kyber.Point) kyber.Point

func (*G2Elt) Null

func (p *G2Elt) Null() kyber.Point

func (*G2Elt) Pick

func (p *G2Elt) Pick(rand cipher.Stream) kyber.Point

func (*G2Elt) Set

func (p *G2Elt) Set(p2 kyber.Point) kyber.Point

func (*G2Elt) String

func (p *G2Elt) String() string

func (*G2Elt) Sub

func (p *G2Elt) Sub(a, b kyber.Point) kyber.Point

func (*G2Elt) UnmarshalBinary

func (p *G2Elt) UnmarshalBinary(data []byte) error

UnmarshalBinary populates the point from a compressed point representation.

func (*G2Elt) UnmarshalFrom

func (p *G2Elt) UnmarshalFrom(r io.Reader) (int, error)

UnmarshalFrom populates the point from a compressed point representation read from the Reader.

type GTElt

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

GTElt is a wrapper around the Circl Gt point type.

func (*GTElt) Add

func (p *GTElt) Add(a, b kyber.Point) kyber.Point

func (*GTElt) Base

func (p *GTElt) Base() kyber.Point

func (*GTElt) Clone

func (p *GTElt) Clone() kyber.Point

func (*GTElt) Data

func (p *GTElt) Data() ([]byte, error)

func (*GTElt) Embed

func (p *GTElt) Embed(_ []byte, _ cipher.Stream) kyber.Point

func (*GTElt) EmbedLen

func (p *GTElt) EmbedLen() int

func (*GTElt) Equal

func (p *GTElt) Equal(p2 kyber.Point) bool

func (*GTElt) MarshalBinary

func (p *GTElt) MarshalBinary() (data []byte, err error)

MarshalBinary returns a compressed point, without any domain separation tag information

func (*GTElt) MarshalSize

func (p *GTElt) MarshalSize() int

func (*GTElt) MarshalTo

func (p *GTElt) MarshalTo(w io.Writer) (int, error)

MarshalTo writes a compressed point to the Writer, without any domain separation tag information

func (*GTElt) Mul

func (p *GTElt) Mul(s kyber.Scalar, q kyber.Point) kyber.Point

func (*GTElt) Neg

func (p *GTElt) Neg(a kyber.Point) kyber.Point

func (*GTElt) Null

func (p *GTElt) Null() kyber.Point

func (*GTElt) Pick

func (p *GTElt) Pick(_ cipher.Stream) kyber.Point

func (*GTElt) Set

func (p *GTElt) Set(p2 kyber.Point) kyber.Point

func (*GTElt) String

func (p *GTElt) String() string

func (*GTElt) Sub

func (p *GTElt) Sub(a, b kyber.Point) kyber.Point

func (*GTElt) UnmarshalBinary

func (p *GTElt) UnmarshalBinary(data []byte) error

UnmarshalBinary populates the point from a compressed point representation.

func (*GTElt) UnmarshalFrom

func (p *GTElt) UnmarshalFrom(r io.Reader) (int, error)

UnmarshalFrom populates the point from a compressed point representation read from the Reader.

type Scalar

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

func (*Scalar) Add

func (s *Scalar) Add(a, b kyber.Scalar) kyber.Scalar

func (*Scalar) ByteOrder

func (s *Scalar) ByteOrder() kyber.ByteOrder

func (*Scalar) Clone

func (s *Scalar) Clone() kyber.Scalar

func (*Scalar) Div

func (s *Scalar) Div(a, b kyber.Scalar) kyber.Scalar

func (*Scalar) Equal

func (s *Scalar) Equal(s2 kyber.Scalar) bool

func (*Scalar) GroupOrder

func (s *Scalar) GroupOrder() *big.Int

func (*Scalar) Inv

func (s *Scalar) Inv(a kyber.Scalar) kyber.Scalar

func (*Scalar) MarshalBinary

func (s *Scalar) MarshalBinary() (data []byte, err error)

func (*Scalar) MarshalSize

func (s *Scalar) MarshalSize() int

func (*Scalar) MarshalTo

func (s *Scalar) MarshalTo(w io.Writer) (int, error)

func (*Scalar) Mul

func (s *Scalar) Mul(a, b kyber.Scalar) kyber.Scalar

func (*Scalar) Neg

func (s *Scalar) Neg(a kyber.Scalar) kyber.Scalar

func (*Scalar) One

func (s *Scalar) One() kyber.Scalar

func (*Scalar) Pick

func (s *Scalar) Pick(stream cipher.Stream) kyber.Scalar

func (*Scalar) Set

func (s *Scalar) Set(a kyber.Scalar) kyber.Scalar

func (*Scalar) SetBytes

func (s *Scalar) SetBytes(data []byte) kyber.Scalar

func (*Scalar) SetInt64

func (s *Scalar) SetInt64(v int64) kyber.Scalar

func (*Scalar) String

func (s *Scalar) String() string

func (*Scalar) Sub

func (s *Scalar) Sub(a, b kyber.Scalar) kyber.Scalar

func (*Scalar) UnmarshalBinary

func (s *Scalar) UnmarshalBinary(data []byte) error

func (*Scalar) UnmarshalFrom

func (s *Scalar) UnmarshalFrom(r io.Reader) (int, error)

func (*Scalar) Zero

func (s *Scalar) Zero() kyber.Scalar

type Suite

type Suite struct{}

func NewSuite

func NewSuite() (s Suite)

func (Suite) G1

func (s Suite) G1() kyber.Group

func (Suite) G2

func (s Suite) G2() kyber.Group

func (Suite) GT

func (s Suite) GT() kyber.Group

func (Suite) Hash

func (s Suite) Hash() hash.Hash

func (Suite) Pair

func (s Suite) Pair(p1, p2 kyber.Point) kyber.Point

func (Suite) RandomStream

func (s Suite) RandomStream() cipher.Stream

func (Suite) Read

func (s Suite) Read(_ io.Reader, _ ...interface{}) error

func (Suite) String

func (s Suite) String() string

func (Suite) ValidatePairing

func (s Suite) ValidatePairing(p1, p2, p3, p4 kyber.Point) bool

func (Suite) Write

func (s Suite) Write(_ io.Writer, _ ...interface{}) error

func (Suite) XOF

func (s Suite) XOF(seed []byte) kyber.XOF

type SuiteBLS12381

type SuiteBLS12381 struct {
	Suite
	kyber.Group
}

SuiteBLS12381 is an adapter that implements the suites.Suite interface so that bls12381 can be used as a common suite to generate key pairs for instance but still preserves the properties of the pairing (e.g. the Pair function).

It's important to note that the Point function will generate a point compatible with public keys only (group G2) where the signature must be used as a point from the group G1.

func NewSuiteBLS12381

func NewSuiteBLS12381() *SuiteBLS12381

NewSuiteBLS12381 makes a new BN256 suite

func (*SuiteBLS12381) Point

func (s *SuiteBLS12381) Point() kyber.Point

Point generates a point from the G2 group that can only be used for public keys

func (*SuiteBLS12381) PointLen

func (s *SuiteBLS12381) PointLen() int

PointLen returns the length of a G2 point

func (*SuiteBLS12381) Scalar

func (s *SuiteBLS12381) Scalar() kyber.Scalar

Scalar generates a scalar

func (*SuiteBLS12381) ScalarLen

func (s *SuiteBLS12381) ScalarLen() int

ScalarLen returns the length of a scalar

func (*SuiteBLS12381) String

func (s *SuiteBLS12381) String() string

String returns the name of the suite

Jump to

Keyboard shortcuts

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