[][src]Trait vrf::VRF

pub trait VRF<PublicKey, SecretKey> {
    type Error;
    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>; }

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

Associated Types

type Error

Loading content...

Required methods

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.

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.
Loading content...

Implementors

impl<'_, '_> VRF<&'_ [u8], &'_ [u8]> for ECVRF[src]

VRFs are objects capable of generating and verifying proofs.

type Error = Error

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

Generates proof from a secret key and message as specified in the VRF-draft-05 (section 5.1).

Arguments

  • x - A slice representing the secret key in octets.
  • alpha - A slice representing the message in octets.

Returns

  • If successful, a vector of octets representing the proof of the VRF.

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

Verifies the provided VRF proof and computes the VRF hash output as specified in VRF-draft-05 (section 5.3).

Arguments

  • y - A slice representing the public key in octets.
  • pi - A slice of octets representing the VRF proof.

Returns

  • If successful, a vector of octets with the VRF hash output.

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

type Error = Error

Loading content...