github.com/igggame/nebulas-go@v2.1.0+incompatible/crypto/keystore/secp256k1/vrf/vrf.go (about) 1 // Copyright 2016 Google Inc. All Rights Reserved. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 // Package vrf defines the interface to a verifiable random function. 16 17 // http://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=814584 18 19 package vrf 20 21 import "crypto" 22 23 // PrivateKey supports evaluating the VRF function. 24 type PrivateKey interface { 25 // Evaluate returns the output of H(f_k(m)) and its proof. 26 Evaluate(m []byte) (index [32]byte, proof []byte) 27 // Public returns the corresponding public key. 28 Public() crypto.PublicKey 29 } 30 31 // PublicKey supports verifying output from the VRF function. 32 type PublicKey interface { 33 // ProofToHash verifies the NP-proof supplied by Proof and outputs Index. 34 ProofToHash(m, proof []byte) (index [32]byte, err error) 35 }