bls

package
v0.0.0-...-a01cb7b Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

README

BLS signature

A Go implementation of the BLS(Boneh–Lynn–Shacham) signature.

Tests

$ go test .

Benchmarks

$ go test -timeout 1h -bench=. -benchtime=1m

Reference

BLS: https://en.wikipedia.org/wiki/BLS_digital_signature

Documentation

Overview

Package bls implements BLS signature

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenRandomKeyPair

func GenRandomKeyPair() (*PrivateKey, *PublicKey, error)

GenRandomKeyPair generate a random BLS private/public key pair for client

func Sign

func Sign(key *PrivateKey, msg []byte) *bls12_381_ecc.G1Affine

Sign generate BLS signature using private key sig = sk * hashToG1(m)

func Verify

func Verify(sig *bls12_381_ecc.G1Affine, pub *PublicKey, msg []byte) (bool, error)

Verify verify BLS signature using public key e(sig, g_2)=e(hashToG1(m), pub)

Types

type PrivateKey

type PrivateKey struct {
	X *big.Int
}

PrivateKey client private key

type PublicKey

type PublicKey struct {
	P *bls12_381_ecc.G2Affine
}

PublicKey client public key

Jump to

Keyboard shortcuts

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