sign

package
v0.0.0-...-0432942 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckG1AndG2DiscreteLogEquality

func CheckG1AndG2DiscreteLogEquality(pointG1 *bn254.G1Affine, pointG2 *bn254.G2Affine) (bool, error)

func GetG1Generator

func GetG1Generator() *bn254.G1Affine

func GetG2Generator

func GetG2Generator() *bn254.G2Affine

func MapToCurve

func MapToCurve(digest [32]byte) *bn254.G1Affine

func MulByGeneratorG1

func MulByGeneratorG1(a *fr.Element) *bn254.G1Affine

func MulByGeneratorG2

func MulByGeneratorG2(a *fr.Element) *bn254.G2Affine

func VerifySig

func VerifySig(sig *bn254.G1Affine, pubkey *bn254.G2Affine, msgBytes [32]byte) (bool, error)

Types

type G1Point

type G1Point struct {
	*bn254.G1Affine
}

func NewG1Point

func NewG1Point(x, y *big.Int) *G1Point

func (*G1Point) Add

func (p *G1Point) Add(p2 *G1Point)

Add another G1 point to this one

func (*G1Point) Clone

func (p *G1Point) Clone() *G1Point

func (*G1Point) Deserialize

func (p *G1Point) Deserialize(data []byte) (*G1Point, error)

func (*G1Point) Hash

func (p *G1Point) Hash() [32]byte

func (*G1Point) Serialize

func (p *G1Point) Serialize() []byte

func (*G1Point) Sub

func (p *G1Point) Sub(p2 *G1Point)

Sub another G1 point from this one

func (*G1Point) Verify

func (p *G1Point) Verify(pubKey *G2Point, message [32]byte) bool

Verify a message against a G2 public key

func (*G1Point) VerifyEquivalence

func (p *G1Point) VerifyEquivalence(p2 *G2Point) (bool, error)

VerifyEquivalence verifies G1Point is equivalent the G2Point

type G2Point

type G2Point struct {
	*bn254.G2Affine
}

func (*G2Point) Add

func (p *G2Point) Add(p2 *G2Point)

Add another G2 point to this one

func (*G2Point) Clone

func (p *G2Point) Clone() *G2Point

func (*G2Point) Deserialize

func (p *G2Point) Deserialize(data []byte) (*G2Point, error)

func (*G2Point) Serialize

func (p *G2Point) Serialize() []byte

func (*G2Point) Sub

func (p *G2Point) Sub(p2 *G2Point)

Sub another G2 point from this one

type KeyPair

type KeyPair struct {
	PrivKey *PrivateKey
	PubKey  *G1Point
}

func GenRandomBlsKeys

func GenRandomBlsKeys() (*KeyPair, error)

func MakeKeyPair

func MakeKeyPair(sk *PrivateKey) *KeyPair

func MakeKeyPairFromString

func MakeKeyPairFromString(sk string) (*KeyPair, error)

func (*KeyPair) GetPubKeyG1

func (k *KeyPair) GetPubKeyG1() *G1Point

func (*KeyPair) GetPubKeyG2

func (k *KeyPair) GetPubKeyG2() *G2Point

func (*KeyPair) SignHashedToCurveMessage

func (k *KeyPair) SignHashedToCurveMessage(g1HashedMsg *G1Point) *Signature

func (*KeyPair) SignMessage

func (k *KeyPair) SignMessage(message [32]byte) *Signature

type PrivateKey

type PrivateKey = fr.Element

type Signature

type Signature struct {
	*G1Point
}

Jump to

Keyboard shortcuts

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