vrf

package
v0.0.0-...-2f68b9a Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2019 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Copyright (c) 2018 The MATRIX Authors Distributed under the MIT software license, see the accompanying file COPYING or or http://www.opensource.org/licenses/mit-license.php

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 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(pri *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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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