blsvrf

package
v1.10.3-0...-ec03cfc Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2021 License: LGPL-3.0, Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidVRF occurs when the VRF does not validate.
	ErrInvalidVRF = errors.New("invalid VRF proof")
)

Functions

func NewVRFSigner

func NewVRFSigner(seck *bls.SecretKey) vrf.PrivateKey

NewVRFSigner creates a signer object from a private key.

func NewVRFVerifier

func NewVRFVerifier(pubkey *bls.PublicKey) vrf.PublicKey

NewVRFVerifier creates a verifier object from a public key.

Types

type PrivateKey

type PrivateKey struct {
	*bls.SecretKey
}

PrivateKey holds a private VRF key.

func (*PrivateKey) Evaluate

func (k *PrivateKey) Evaluate(alpha []byte) ([32]byte, []byte)

Evaluate returns the verifiable unpredictable function evaluated using alpha verifiable unpredictable function using BLS reference: https://tools.ietf.org/html/draft-goldbe-vrf-01 properties of VRF-BLS: 1) Full Uniqueness : satisfied, it is deterministic 2) Full Pseudorandomness : satisfied through sha256 3) Full Collison Resistance : satisfied through sha256

func (*PrivateKey) Public

func (k *PrivateKey) Public() crypto.PublicKey

Public returns the corresponding public key as bytes.

type PublicKey

type PublicKey struct {
	*bls.PublicKey
}

PublicKey holds a public VRF key.

func (*PublicKey) Deserialize

func (pk *PublicKey) Deserialize(data []byte)

Deserialize de-serialize bytes into public key

func (*PublicKey) ProofToHash

func (pk *PublicKey) ProofToHash(alpha, pi []byte) ([32]byte, error)

ProofToHash asserts that proof is correct for input alpha and output VRF hash

func (*PublicKey) Serialize

func (pk *PublicKey) Serialize() []byte

Serialize serialize the public key into bytes

Jump to

Keyboard shortcuts

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