goblst

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2023 License: Apache-2.0 Imports: 9 Imported by: 1

README

goblst

A minimalistic Go binding for blst BLS12-381 signature library targeted to Tezos ecosystem

Documentation

Index

Constants

View Source
const (
	P1ByteLength     = 48
	P2ByteLength     = 96
	ScalarByteLength = 32
)

Variables

View Source
var ErrNotUnique = errors.New("messages are not unique")

Functions

This section is empty.

Types

type Error

type Error int
const (
	ErrSuccess          Error = Error(C.BLST_SUCCESS)
	ErrBadEncoding      Error = Error(C.BLST_BAD_ENCODING)
	ErrPointNotOnCurve  Error = Error(C.BLST_POINT_NOT_ON_CURVE)
	ErrPointNotInGroup  Error = Error(C.BLST_POINT_NOT_IN_GROUP)
	ErrAggrTypeMismatch Error = Error(C.BLST_AGGR_TYPE_MISMATCH)
	ErrVerifyFail       Error = Error(C.BLST_VERIFY_FAIL)
	ErrPkIsInfinity     Error = Error(C.BLST_PK_IS_INFINITY)
	ErrBadScalar        Error = Error(C.BLST_BAD_SCALAR)
)

func (Error) Error

func (e Error) Error() string

type Fp

type Fp fp

type Fp12

type Fp12 fp12

func AggregatedInG1

func AggregatedInG1(sig *P1Affine) *Fp12

func AggregatedInG2

func AggregatedInG2(sig *P2Affine) *Fp12

type Fp2

type Fp2 fp2

type P1

type P1 p1

func EncodeToP1

func EncodeToP1(digest, suite, aug []byte) *P1

func HashToP1

func HashToP1(digest, suite, aug []byte) *P1

func (*P1) AddOrDoubleAffine

func (p *P1) AddOrDoubleAffine(other *P1Affine)

func (*P1) Affine

func (p *P1) Affine() *P1Affine

func (*P1) Compress

func (p *P1) Compress() []byte

func (*P1) Equal

func (p *P1) Equal(x *P1) bool

func (*P1) IsInG1

func (p *P1) IsInG1() bool

func (*P1) IsInf

func (p *P1) IsInf() bool

func (*P1) IsOnCurve

func (p *P1) IsOnCurve() bool

type P1Affine

type P1Affine p1Affine

func DecompressP1Affine

func DecompressP1Affine(compressed []byte) (*P1Affine, error)

func (*P1Affine) Compress

func (p *P1Affine) Compress() []byte

func (*P1Affine) CoreAggregateVerify

func (sig *P1Affine) CoreAggregateVerify(validate_sig bool, items PkMsgPairsG1, validate_pub bool, hash bool, suite []byte) error

func (*P1Affine) CoreVerify

func (sig *P1Affine) CoreVerify(validate_sig bool, pub *P2Affine, validate_pub bool, msg []byte, hash bool, suite []byte, aug []byte) error

func (*P1Affine) Equal

func (p *P1Affine) Equal(x *P1Affine) bool

func (*P1Affine) IsInG1

func (p *P1Affine) IsInG1() bool

func (*P1Affine) IsInf

func (p *P1Affine) IsInf() bool

func (*P1Affine) IsOnCurve

func (p *P1Affine) IsOnCurve() bool

func (*P1Affine) Jacobian

func (p *P1Affine) Jacobian() *P1

type P2

type P2 p2

func EncodeToP2

func EncodeToP2(digest, suite, aug []byte) *P2

func HashToP2

func HashToP2(digest, suite, aug []byte) *P2

func (*P2) AddOrDoubleAffine

func (p *P2) AddOrDoubleAffine(other *P2Affine)

func (*P2) Affine

func (p *P2) Affine() *P2Affine

func (*P2) Compress

func (p *P2) Compress() []byte

func (*P2) Equal

func (p *P2) Equal(x *P2) bool

func (*P2) IsInG2

func (p *P2) IsInG2() bool

func (*P2) IsInf

func (p *P2) IsInf() bool

func (*P2) IsOnCurve

func (p *P2) IsOnCurve() bool

type P2Affine

type P2Affine p2Affine

func DecompressP2Affine

func DecompressP2Affine(compressed []byte) (*P2Affine, error)

func (*P2Affine) Compress

func (p *P2Affine) Compress() []byte

func (*P2Affine) CoreAggregateVerify

func (sig *P2Affine) CoreAggregateVerify(validate_sig bool, items PkMsgPairsG2, validate_pub bool, hash bool, suite []byte) error

func (*P2Affine) CoreVerify

func (sig *P2Affine) CoreVerify(validate_sig bool, pub *P1Affine, validate_pub bool, msg []byte, hash bool, suite []byte, aug []byte) error

func (*P2Affine) Equal

func (p *P2Affine) Equal(x *P2Affine) bool

func (*P2Affine) IsInG2

func (p *P2Affine) IsInG2() bool

func (*P2Affine) IsInf

func (p *P2Affine) IsInf() bool

func (*P2Affine) IsOnCurve

func (p *P2Affine) IsOnCurve() bool

func (*P2Affine) Jacobian

func (p *P2Affine) Jacobian() *P2

type Pairing

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

aligned memory

func NewPairing

func NewPairing(hash bool, suite []byte) *Pairing

func (*Pairing) AggregateInG1

func (p *Pairing) AggregateInG1(pub *P1Affine, validate_pub bool, sig *P2Affine, validate_sig bool, msg, aug []byte) error

func (*Pairing) AggregateInG2

func (p *Pairing) AggregateInG2(pub *P2Affine, validate_pub bool, sig *P1Affine, validate_sig bool, msg, aug []byte) error

func (*Pairing) Commit

func (p *Pairing) Commit()

func (*Pairing) FinalVerify

func (p *Pairing) FinalVerify(gtsig *Fp12) bool

func (*Pairing) Merge

func (p *Pairing) Merge(other *Pairing) error

type PkMsgPairG1

type PkMsgPairG1 interface {
	Public() *P2Affine
	Message() []byte
	Augmentation() []byte
}

type PkMsgPairG2

type PkMsgPairG2 interface {
	Public() *P1Affine
	Message() []byte
	Augmentation() []byte
}

type PkMsgPairsG1

type PkMsgPairsG1 interface {
	Len() int
	Index(int) PkMsgPairG1
}

type PkMsgPairsG2

type PkMsgPairsG2 interface {
	Len() int
	Index(int) PkMsgPairG2
}

type Scalar

type Scalar scalar

func GenerateKey

func GenerateKey(ikm []byte) (*Scalar, error)

func ScalarFromBytes

func ScalarFromBytes(data []byte) (*Scalar, error)

func (*Scalar) Bytes

func (s *Scalar) Bytes() []byte

func (*Scalar) Equal

func (s *Scalar) Equal(x *Scalar) bool

func (*Scalar) P1

func (s *Scalar) P1() *P1

func (*Scalar) P1Affine

func (s *Scalar) P1Affine() *P1Affine

func (*Scalar) P2

func (s *Scalar) P2() *P2

func (*Scalar) P2Affine

func (s *Scalar) P2Affine() *P2Affine

func (*Scalar) SignInG1

func (s *Scalar) SignInG1(hash *P2) *P2

func (*Scalar) SignInG1Affine

func (s *Scalar) SignInG1Affine(hash *P2) *P2Affine

func (*Scalar) SignInG2

func (s *Scalar) SignInG2(hash *P1) *P1

func (*Scalar) SignInG2Affine

func (s *Scalar) SignInG2Affine(hash *P1) *P1Affine

type Scheme

type Scheme int
const (
	Basic Scheme = iota
	Augmentation
)

func (Scheme) HashFunc

func (Scheme) HashFunc() crypto.Hash

func (Scheme) SuiteG

func (s Scheme) SuiteG(g int) []byte

Directories

Path Synopsis
blst

Jump to

Keyboard shortcuts

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