pub struct ECVRF { /* private fields */ }

Implementations

Associated function to initialize a ECVRF structure with an initialized context for the given cipher suite.

Arguments:
  • suite: Identifying ciphersuite
Returns:
  • a ECVRF struct if successful

ECVRF_hash_to_curve implementation as specified in Section 5.4.1.1 [VRF-draft-05]

Arguments
  • public_key: an Elliptical Curve point
  • alpha_string: value to be hashed, an octet string
Returns:
  • a finite EC point in G

Converts an arbitrary string to a point in the curve as specified in Section 5.5 [VRF-draft-05]

Arguments
  • data: a 32 octet string to be converted to a point
returns an EcPoint representing the converted point if successful

Generates a nonce deterministically from the algorithm specified in Section 3.2 RFC6979

Arguments
  • secret key: a BigNum representing the secret key.
  • data: a slice of octets representing the message
Returns:
  • a BigNum representing the nonce.

Hashes a slice of EC points to a BigNum integer as specified in Section 5.4.3 [VRF-draft-05]

Arguments
  • points: a slice of points that need to be hashed
Returns:
  • a BigNum integer (0 < x < 2^(8n) - 1) representing the hash of points truncated to length n, if successful.

Function to derive public key point given a private key.

Arguments
  • private_key: a BigNum representing the private key
Returns:
  • an EcPoint representing the public key, if successful

Function to derive public key given a private key.

Arguments
  • private_key: a slice of octets representing the private key
Returns:
  • an slice of octets representing the public key, if successful

Function to decode a proof pi_string produced by EC_prove, to (gamma, c, s) as specified in Section 5.4.4 [VRF-draft-05]

Arguments
  • pi_string: a slice of octets representing the generated proof
Returns
  • gamma: an EcPoint
  • c: integer between 0 and 2 ^ (8n) - 1
  • s: integer between 0 and 2 ^ (8qlen) - 1

Trait Implementations

Generates proof from a private key and a message as specified in Section 5.1 [VRF-draft-05]

Arguments:
  • pkey: a private key
  • alpha_string: octet string message represented by a slice
Returns:
  • if successful, a vector of octets representing the proof pi_string

Generates ECVRF hash output from the provided proof

Arguments:
  • pi_string: generated ECVRF proof
Returns
  • beta_string: the ECVRF hash output

Verifies the provided VRF proof and computes the VRF hash output

Arguments:
  • public_key: a slice representing the public key in octets
  • alpha_string: VRF hash input, an octet string
  • pi_string: proof to be verified, an octet string
Returns:
  • if successful, a vector of octets with the VRF hash output

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.