vrfEc

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2019 License: GPL-3.0, GPL-3.0 Imports: 13 Imported by: 0

Documentation

Overview

* @author PalletOne core developers <dev@pallet.one> * @date 2018

* @author PalletOne core developers <dev@pallet.one> * @date 2018

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrKeyNotSupported = errors.New("only support ECC key")
	ErrEvalVRF         = errors.New("failed to evaluate vrf")
)
View Source
var (
	ErrInvalidVRF  = errors.New("invalid VRF proof")
	ErrInvalidHash = errors.New("hash function does not match elliptic curve bitsize")
)

Functions

func Evaluate

func Evaluate(pri *ecdsa.PrivateKey, h hash.Hash, m []byte) (index [32]byte, proof []byte)

Evaluate returns the verifiable unpredictable(random) function evaluated at m

func ProofToHash

func ProofToHash(pk *ecdsa.PublicKey, h hash.Hash, m, proof []byte) (index [32]byte, err error)

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

func VrfProof2Value

func VrfProof2Value(curve *elliptic.CurveParams, proof []byte) []byte

func VrfProve

func VrfProve(pri *ecdsa.PrivateKey, msg []byte) (proof []byte, err error)

Vrf returns the verifiable random function evaluated m and a NIZK proof func VrfProve(pri *ecdsa.PrivateKey, msg []byte) (vrfValue, vrfProof []byte, err error) {

func VrfVerify

func VrfVerify(pub *ecdsa.PublicKey, msg, proof []byte) (bool, error)

Verify returns true if vrf and nizk is correct for msg func VrfVerify(pub *ecdsa.PublicKey, msg, vrfValue, vrfProof []byte) (bool, error) {

Types

This section is empty.

Jump to

Keyboard shortcuts

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