vrf

package
v0.0.0-...-ac76756 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

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 HashToBigInt

func HashToBigInt(hash []byte) *big.Int

HashToBigInt Convert hash value to big integer

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 ValidatePrivateKey

func ValidatePrivateKey(prv *ecdsa.PrivateKey) bool

* ValidatePrivateKey checks two conditions: * - the private key must be of type ec.PrivateKey * - the private key must use curve secp256r1

func ValidatePublicKey

func ValidatePublicKey(pub *ecdsa.PublicKey) bool

* ValidatePublicKey checks two conditions: * - the public key must be of type ec.PublicKey * - the public key must use curve secp256r1

func Verify

func Verify(pub *ecdsa.PublicKey, msg, vrf, nizk []byte) (bool, error)

Verify returns true if vrf and nizk is correct for msg

func Vrf

func Vrf(prv *ecdsa.PrivateKey, msg []byte) (vrf, nizk []byte, err error)

Vrf returns the verifiable random function evaluated m and a NIZK proof

Types

This section is empty.

Jump to

Keyboard shortcuts

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