vrf

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: May 17, 2019 License: MIT Imports: 21 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Copyright (c) 2018 The MATRIX Authors Distributed under the MIT software license, see the accompanying file COPYING 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