vrfEc

package
v1.0.9 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2020 License: GPL-3.0, GPL-3.0 Imports: 14 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

Types

type Ec

type Ec struct {
}

func (*Ec) VrfProve

func (e *Ec) VrfProve(priKey interface{}, msg []byte) (proof, selData []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 (*Ec) VrfVerify

func (e *Ec) VrfVerify(pubKey, msg, proof []byte) (bool, []byte, error)

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

Jump to

Keyboard shortcuts

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