v1.69.0 Latest Latest

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

Go to latest
Published: May 31, 2024 License: BSD-3-Clause Imports: 13 Imported by: 6



Package secp256k1 implements a verifiable random function using curve secp256k1.



This section is empty.


View Source
var (

	// ErrInvalidVRF err
	ErrInvalidVRF = errors.New("invalid VRF proof")


func GenerateKey

func GenerateKey() (vrfp.PrivateKey, vrfp.PublicKey)

GenerateKey generates a fresh keypair for this VRF

func H1

func H1(m []byte) (x, y *big.Int)

H1 hashes m to a curve point

func H2

func H2(m []byte) *big.Int

H2 hashes to an integer [1,N-1]

func Unmarshal

func Unmarshal(curve elliptic.Curve, data []byte) (x, y *big.Int)

Unmarshal a compressed point in the form specified in section 4.3.6 of ANSI X9.62.


type PrivateKey

type PrivateKey struct {

PrivateKey holds a private VRF key.

func (PrivateKey) Evaluate

func (k PrivateKey) Evaluate(m []byte) (index [32]byte, proof []byte)

Evaluate returns the verifiable unpredictable function evaluated at m

func (PrivateKey) Public

func (k PrivateKey) Public() crypto.PublicKey

Public returns the corresponding public key as bytes.

type PublicKey

type PublicKey struct {

PublicKey holds a public VRF key.

func (*PublicKey) ProofToHash

func (pk *PublicKey) ProofToHash(m, proof []byte) (index [32]byte, err error)

ProofToHash asserts that proof is correct for m and outputs index.

Jump to

Keyboard shortcuts

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