ecvrf

package
v0.0.0-...-1f23a7b Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2023 License: BSD-3-Clause Imports: 8 Imported by: 6

Documentation

Overview

Package ecvrf implements the "Verifiable Random Functions (VRFs)" IETF draft, providing the ECVRF-EDWARDS25519-SHA512-ELL2 suite.

Index

Constants

View Source
const (
	// ProofSize is the size, in bytes, of proofs as used in this package.
	ProofSize = 80

	// OutputSize is the size, in bytes, of outputs as used in this package.
	OutputSize = 64
)

Variables

This section is empty.

Functions

func ProofToHash

func ProofToHash(piString []byte) ([]byte, error)

ProofToHash implements ECVRF_proof_to_hash for the suite ECVRF-EDWARDS25519-SHA512-ELL2, in variable-time.

ECVRF_proof_to_hash should be run only on pi_string that is known to have been produced by ECVRF_prove, or from within ECVRF_verify.

func Prove

func Prove(sk ed25519.PrivateKey, alphaString []byte) []byte

Prove implements ECVRF_prove for the suite ECVRF-EDWARDS25519-SHA512-ELL2.

func ProveWithAddedRandomness

func ProveWithAddedRandomness(rand io.Reader, sk ed25519.PrivateKey, alphaString []byte) ([]byte, error)

ProveWithAddedRandomness implements ECVRF_prove for the suite ECVRF-EDWARDS25519-SHA512-ELL2, while including additional randomness to mitigate certain fault injection and side-channel attacks. If rand is nil, crypto/rand.Reader will be used.

Warning: If this is set, proofs (`pi_string`) will be non-deterministic. The VRF output (`beta_string`) is identical to that produced by Prove.

func ProveWithAddedRandomness_v10

func ProveWithAddedRandomness_v10(rand io.Reader, sk ed25519.PrivateKey, alphaString []byte) ([]byte, error)

ProveWithAddedRandomness_v10 is ProveWithAddedRandomness but using the v10 (and earlier) semantics.

func Prove_v10

func Prove_v10(sk ed25519.PrivateKey, alphaString []byte) []byte

Prove_v10 is Prove but using the v10 (and earlier) semantics.

func Verify

func Verify(pk ed25519.PublicKey, piString, alphaString []byte) (bool, []byte)

Verify implements ECVRF_verify for the suite ECVRF-EDWARDS25519-SHA512-ELL2.

The public key is validated such that the "full uniqueness" and "full collision" properties are satisfied.

func Verify_v10

func Verify_v10(pk ed25519.PublicKey, piString, alphaString []byte) (bool, []byte)

Verify_v10 is Verify but using the v10 (and earlier) semantics.

Types

This section is empty.

Jump to

Keyboard shortcuts

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