Documentation
¶
Overview ¶
Package vrf implements a verifiable random function using the Edwards form of Curve25519, SHA3 and the Elligator map.
E is Curve25519 (in Edwards coordinates), h is SHA512.
f is the elligator map (bytes->E) that covers half of E.
8 is the cofactor of E, the group order is 8*l for prime l.
Setup : the prover publicly commits to a public key (P : E)
H : names -> E
H(n) = f(h(n))^8
VRF : keys -> names -> vrfs
VRF_x(n) = h(n, H(n)^x))
Prove : keys -> names -> proofs
Prove_x(n) = tuple(c=h(n, g^r, H(n)^r), t=r-c*x, ii=H(n)^x)
where r = h(x, n) is used as a source of randomness
Check : E -> names -> vrfs -> proofs -> bool
Check(P, n, vrf, (c,t,ii)) = vrf == h(n, ii)
&& c == h(n, g^t*P^c, H(n)^t*ii^c)
Index ¶
Constants ¶
const ( PublicKeySize = 32 PrivateKeySize = 64 Size = 32 ProofSize = 32 + 32 + intermediateSize )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PrivateKey ¶
type PrivateKey [PrivateKeySize]byte
PrivateKey represents a Curve25519 private key.
func GenerateKey ¶
func GenerateKey(rnd io.Reader) (sk PrivateKey, err error)
GenerateKey creates a Curve25519 public/private key pair using rnd for randomness. Only the private key sk is returned (call sk.Public() the get the corresponding public key). If rnd is nil, crypto/rand is used.
func (PrivateKey) Compute ¶
func (sk PrivateKey) Compute(m []byte) []byte
Compute generates the vrf value for the byte slice m using the underlying private key sk.
func (PrivateKey) Prove ¶
func (sk PrivateKey) Prove(m []byte) (vrf, proof []byte)
Prove returns the vrf value and a proof such that Verify(pk, m, vrf, proof) == true. The vrf value is the same as returned by Compute(m, sk).
func (PrivateKey) Public ¶
func (sk PrivateKey) Public() (publicKey PublicKey)
Public extracts the public VRF key from the underlying private-key
func (PrivateKey) Sign ¶
func (sk PrivateKey) Sign(m []byte) (signature []byte)
Sign returns the vrf value and a proof such that Verify(m, vrf, proof) == true. The vrf value is the same as returned by Compute(m).
Directories
¶
| Path | Synopsis |
|---|---|
|
Package edwards25519 implements operations in GF(2**255-19) and on an Edwards curve that is isomorphic to curve25519.
|
Package edwards25519 implements operations in GF(2**255-19) and on an Edwards curve that is isomorphic to curve25519. |