bls12381

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: May 10, 2023 License: Apache-2.0 Imports: 7 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// SignatureSize is the size, in bytes, of a compressed BLS signature
	SignatureSize = 48
	// PubKeySize is the size, in bytes, of a compressed BLS public key
	PubKeySize = 96
	// SeedSize is the size, in bytes, of private key seeds
	SeedSize = 32
)

Variables

View Source
var DST = []byte("BLS_SIG_BLS12381G1_XMD:SHA-256_SSWU_RO_NUL_")

Domain Separation Tag for signatures on G1 (minimal-signature-size)

Functions

func GenKeyPair

func GenKeyPair() (PrivateKey, PublicKey)

GenKeyPair generates a random BLS key pair based on a given seed the public key is compressed with 96 byte size

func Verify

func Verify(sig Signature, pk PublicKey, msg []byte) (bool, error)

Verify verifies a BLS sig over msg with a BLS public key the sig and public key are all compressed

func VerifyMultiSig

func VerifyMultiSig(sig Signature, pks []PublicKey, msg []byte) (bool, error)

VerifyMultiSig verifies a BLS sig (compressed) over a message with a group of BLS public keys (compressed)

Types

type BlsMultiPubKey

type BlsMultiPubKey = blst.P2Aggregate

type BlsMultiSig

type BlsMultiSig = blst.P1Aggregate

type BlsPubKey

type BlsPubKey = blst.P2Affine

For minimal-signature-size operations:

type BlsSig

type BlsSig = blst.P1Affine

type PrivateKey

type PrivateKey []byte

func GenPrivKey

func GenPrivKey() PrivateKey

func GenPrivKeyFromSecret

func GenPrivKeyFromSecret(secret []byte) PrivateKey

func (PrivateKey) PubKey

func (sk PrivateKey) PubKey() PublicKey

type PublicKey

type PublicKey []byte

func AggrPK

func AggrPK(existingPK PublicKey, newPK PublicKey) (PublicKey, error)

AggrPK aggregates BLS public keys in an accumulative manner

func AggrPKList

func AggrPKList(pks []PublicKey) (PublicKey, error)

AggrPKList aggregates BLS public keys into a single BLS public key

func (PublicKey) Bytes

func (pk PublicKey) Bytes() []byte

func (PublicKey) Equal

func (pk PublicKey) Equal(k PublicKey) bool

func (PublicKey) Marshal

func (pk PublicKey) Marshal() ([]byte, error)

func (PublicKey) MarshalTo

func (pk PublicKey) MarshalTo(data []byte) (int, error)

func (PublicKey) MustMarshal

func (pk PublicKey) MustMarshal() []byte

func (PublicKey) Size

func (pk PublicKey) Size() int

func (*PublicKey) Unmarshal

func (pk *PublicKey) Unmarshal(data []byte) error

type Signature

type Signature []byte

func AggrSig

func AggrSig(existingSig Signature, newSig Signature) (Signature, error)

AggrSig aggregates BLS signatures in an accumulative manner

func AggrSigList

func AggrSigList(sigs []Signature) (Signature, error)

AggrSigList aggregates BLS sigs into a single BLS signature

func NewBLSSigFromHex

func NewBLSSigFromHex(s string) (Signature, error)

func Sign

func Sign(sk PrivateKey, msg []byte) Signature

Sign signs on a msg using a BLS secret key the returned sig is compressed version with 48 byte size

func (Signature) Bytes

func (sig Signature) Bytes() []byte

func (Signature) Equal

func (sig Signature) Equal(s Signature) bool

func (Signature) Marshal

func (sig Signature) Marshal() ([]byte, error)

func (Signature) MarshalTo

func (sig Signature) MarshalTo(data []byte) (int, error)

func (Signature) MustMarshal

func (sig Signature) MustMarshal() []byte

func (Signature) Size

func (sig Signature) Size() int

func (Signature) String

func (sig Signature) String() string

func (*Signature) Unmarshal

func (sig *Signature) Unmarshal(data []byte) error

func (Signature) ValidateBasic

func (sig Signature) ValidateBasic() error

Jump to

Keyboard shortcuts

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