VRF

Trait VRF 

Source
pub trait VRF<PublicKey, SecretKey> {
    type Error;

    // Required methods
    fn prove(
        &mut self,
        x: SecretKey,
        alpha: &[u8],
    ) -> Result<Vec<u8>, Self::Error>;
    fn verify(
        &mut self,
        y: PublicKey,
        pi: &[u8],
        alpha: &[u8],
    ) -> Result<Vec<u8>, Self::Error>;
}
Expand description

A trait containing the common capabilities for all Verifiable Random Functions (VRF) implementations.

Required Associated Types§

Required Methods§

Source

fn prove(&mut self, x: SecretKey, alpha: &[u8]) -> Result<Vec<u8>, Self::Error>

Generates proof from a secret key and a message.

§Arguments
  • x - A secret key.
  • alpha - A slice representing the message in octets.
§Returns
  • If successful, a vector of octets representing the proof of the VRF.
Source

fn verify( &mut self, y: PublicKey, pi: &[u8], alpha: &[u8], ) -> Result<Vec<u8>, Self::Error>

Verifies the provided VRF proof and computes the VRF hash output.

§Arguments
  • y - A public key.
  • pi - A slice of octets representing the VRF proof.
§Returns
  • If successful, a vector of octets with the VRF hash output.

Implementors§

Source§

impl VRF<&[u8], &[u8]> for ECVRF

VRFs are objects capable of generating and verifying proofs.

Source§

impl<'a> VRF<&'a [u8; 33], &'a [u8; 32]> for DummyVRF