<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE rfc [
  <!ENTITY nbsp    "&#160;">
  <!ENTITY zwsp   "&#8203;">
  <!ENTITY nbhy   "&#8209;">
  <!ENTITY wj     "&#8288;">
]>
<?rfc toc="yes"?>
<?rfc symrefs="yes"?>
<?rfc compact="yes"?>
<?rfc subcompact="no"?>
<?rfc strict="no"?>
<?rfc rfcedstyle="yes"?>
<?rfc comments="yes"?>
<?rfc inline="yes"?>
<rfc xmlns:xi="http://www.w3.org/2001/XInclude" category="info" docName="draft-irtf-cfrg-vrf-13" ipr="trust200902" obsoletes="" updates="" submissionType="IETF" xml:lang="en" tocInclude="true" symRefs="true" version="3">
  <!-- xml2rfc v2v3 conversion 3.11.1 -->
  <front>
    <title abbrev="VRF">Verifiable Random Functions (VRFs)</title>
    <seriesInfo name="Internet-Draft" value="draft-irtf-cfrg-vrf-13"/>
    <author fullname="Sharon Goldberg" initials="S." surname="Goldberg">
      <organization>Boston University</organization>
      <address>
        <postal>
          <street>111 Cummington Mall</street>
          <city>Boston</city>
          <region>MA</region>
          <code>02215</code>
          <country>USA</country>
        </postal>
        <email>goldbe@cs.bu.edu</email>
      </address>
    </author>
    <author fullname="Leonid Reyzin" initials="L." surname="Reyzin">
      <organization>Boston University and Algorand</organization>
      <address>
        <postal>
          <street>111 Cummington Mall</street>
          <city>Boston</city>
          <region>MA</region>
          <code>02215</code>
          <country>USA</country>
        </postal>
        <email>reyzin@bu.edu</email>
      </address>
    </author>
    <author fullname="Dimitrios Papadopoulos" initials="D." surname="Papadopoulos">
      <organization>Hong Kong University of Science and Technology</organization>
      <address>
        <postal>
          <street>Clearwater Bay</street>
          <country>Hong Kong</country>
        </postal>
        <email>dipapado@cse.ust.hk</email>
      </address>
    </author>
    <author fullname="Jan Vcelak" initials="J." surname="Vcelak">
      <organization>NS1</organization>
      <address>
        <postal>
          <street>16 Beaver St</street>
          <city>New York</city>
          <region>NY</region>
          <code>10004</code>
          <country>USA</country>
        </postal>
        <email>jvcelak@ns1.com</email>
      </address>
    </author>
    <date year="2022"/>
    <workgroup>CFRG</workgroup>
    <keyword>public key cryptography</keyword>
    <keyword>hashing</keyword>
    <keyword>authenticated denial</keyword>
    <abstract>
      <t>
        A Verifiable Random Function (VRF) is the public-key version of a
        keyed cryptographic hash. Only the holder of the private key
        can compute the hash, but anyone with the public key
        can verify the correctness of the hash.    
        VRFs are useful for preventing enumeration of hash-based data structures.
        This document specifies several VRF constructions based on RSA and Elliptic Curves that are secure in
        the cryptographic random oracle model.
      </t>
      <t>
          This document is a product of the Crypto Forum Research Group (CFRG) in the IRTF.
      </t>
    </abstract>
  </front>
  <middle>
    <section anchor="intro" numbered="true" toc="default">
      <name>Introduction</name>
        <t>
   A Verifiable Random Function
   (VRF) <xref target="MRV99" format="default"/> is the public-key version of a
   keyed cryptographic hash. Only the holder of the private VRF key
   can compute the hash, but anyone with the corresponding public key
   can verify the correctness of the hash.
        </t>
        <t>
   A key application of the VRF is to provide privacy against 
   offline dictionary attacks (also known as enumeration attacks) on data stored in a
   hash-based data structure. 
   In this application, a Prover holds the VRF private key and uses the VRF hashing to
   construct a hash-based data structure on the input data.

   Due to the nature of the VRF, only the Prover can answer queries
   about whether or not some data is stored in the data structure.  Anyone who
   knows the public VRF key can verify that the Prover has answered the queries
   correctly. However, no offline inferences (i.e. inferences without querying
   the Prover) can be made about the data stored in the data structure.
        </t>
    <t>This document defines a number of different VRFs based on RSA and elliptic curves. The particular choice of the VRF depends on the desired security properties, the availability of cryptographically strong implementations, efficiency constraints, and the trust one places in RSA and elliptic curve Diffie-Hellman assumptions (and the trust in a particular choice of curve in case of elliptic curves). Differences in the security properties provided by the different options are discussed in <xref target="secdef" format="default"/> and <xref target="securitycons" format="default"/>.</t>
         <t>
            This document represents the consensus of the Crypto Forum Research Group (CFRG).
        </t>
        <!--
   <t>
       VRFs are used for this purpose to prevent zone content enumeration in
       Domain Name System Security Extensions (DNSSEC) with NSEC5 Authenticated
       Denial of Existence <xref target="I-D.vcelak-nsec5"/>.
   </t>
   -->
      <section numbered="true" toc="default">
        <name>Requirements</name>
        <t>
                The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
                "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
                document are to be interpreted as described in
                <xref target="RFC8174" format="default"/>.
        </t>
      </section>
      <section numbered="true" toc="default">
        <name>Terminology</name>
        <t>
                The following terminology is used through this document:
        </t>
        <dl newline="false" spacing="normal">
          <dt>SK:</dt>
          <dd>
                        The private key for the VRF. 
                    </dd>
          <dt>PK:</dt>
          <dd>
                        The public key for the VRF. 
                    </dd>
          <dt>alpha or alpha_string:</dt>
          <dd>
                        The input to be hashed by the VRF. 
                    </dd>
          <dt>beta or beta_string:</dt>
          <dd>
                        The VRF hash output. 
                    </dd>
          <dt>pi or pi_string:</dt>
          <dd>
                        The VRF proof. 
                    </dd>
          <dt>Prover:</dt>
          <dd>
                        The Prover holds the private VRF key SK and public VRF key PK.
                    </dd>
          <dt>Verifier:</dt>
          <dd>
                        The Verifier holds the public VRF key PK.
                    </dd>
        </dl>
      </section>
    </section>
    <section numbered="true" toc="default">
      <name>VRF Algorithms</name>
      <t>
   A VRF comes with a key generation algorithm that generates a public VRF 
   key PK and private VRF key SK. 
      </t>
      <t>
   The prover hashes an input alpha using the private VRF key SK to obtain a VRF
   hash output beta
      </t>
      <ul empty="true" spacing="normal">
        <li> beta = VRF_hash(SK, alpha) </li>
      </ul>
      <t>
   The VRF_hash algorithm is deterministic, in 
   the sense that it always produces the same output beta given the same
   pair of inputs (SK, alpha).
      
   The prover also uses the private key SK to construct a
   proof pi that beta is the correct hash output 
      </t>
      <ul empty="true" spacing="normal">
        <li>pi = VRF_prove(SK, alpha)</li>
      </ul>
      <t>
   The VRFs defined in this document allow anyone to deterministically
   obtain the VRF hash output beta directly from the proof value pi by using
   the function VRF_proof_to_hash:
      </t>
      <ul empty="true" spacing="normal">
        <li> beta = VRF_proof_to_hash(pi)</li>
      </ul>
      <t>
   Thus, for VRFs defined in this document, VRF_hash is defined as
      </t>
      <ul empty="true" spacing="normal">
        <li> VRF_hash(SK, alpha) = VRF_proof_to_hash(VRF_prove(SK, alpha)),</li>
      </ul>
      <t>
   and therefore this document will specify VRF_prove and VRF_proof_to_hash
   rather than VRF_hash.
      </t>
      <t>
   The proof pi allows a Verifier holding the public key PK
   to verify that beta is the correct VRF hash of input alpha
   under key PK. Thus, the VRFs defined in this document also come with an algorithm
      </t>
      <ul empty="true" spacing="normal">
        <li>   VRF_verify(PK, alpha, pi)</li>
      </ul>
      <t>
   that outputs (VALID, beta = VRF_proof_to_hash(pi)) if pi is valid,
   and INVALID otherwise.
      </t>
    </section>
    <section anchor="secdef" numbered="true" toc="default">
      <name>VRF Security Properties</name>
      <t> VRFs are designed to ensure the following security properties.
      </t>
      <section anchor="uniqueness" numbered="true" toc="default">
        <name>Full Uniqueness or Trusted Uniqueness</name>
        <t> Uniqueness means that, for any fixed public
	VRF key and for any input alpha, there is a unique VRF
	output beta that can be proved to be valid.  Uniqueness must hold
    even for an adversarial Prover that knows the VRF private key SK.
        </t>
        <t>
    More precisely, "full uniqueness" states that a computationally-bounded adversary cannot
	choose 
    a VRF public key PK, 
    a VRF input alpha, 
    and two proofs pi1 and pi2 such that
    VRF_verify(PK, alpha, pi1) outputs (VALID, beta1),
    VRF_verify(PK, alpha, pi2) outputs (VALID, beta2),
    and beta1 is not equal to beta2.
        </t>
        <t>
     For many applications, a slightly weaker security
     property called "trusted uniqueness" suffices.
     Trusted uniqueness is the same as full uniqueness, but it is guaranteed to hold
     only if the VRF keys PK and SK were generated in a trustworthy 
     manner.
        </t>
        <t>
        As further discussed in <xref target="untrustedkeys" format="default"/>,
        some VRFs specified in this document satisfy only trusted uniqueness, while others satisfy full uniqueness.
        VRFs in this document that satisfy only trusted uniqueness but not full uniqueness MUST NOT be used if the key generation
        process cannot be trusted.
        </t>
      </section>
      <section anchor="collisionresistance" numbered="true" toc="default">
        <name>Full Collison Resistance or Trusted Collision Resistance</name>
        <t>Like any cryptographic hash function, VRFs need to be
        collision resistant.  Collison resistance must hold
    even for an adversarial Prover that knows the VRF private key SK.
        </t>
        <t> More precisely, "full collision resistance" states that
        it should be computationally 
        infeasible for an adversary to find two distinct VRF
	    inputs alpha1 and alpha2 that have the same VRF hash beta, 
        even if that adversary knows the private VRF key SK.
        </t>
        <t>
	    For many applications, a slightly weaker security property
        called "trusted collision resistance" suffices. 
        Trusted collision resistance is the same as collision resistance, 
        but it is guaranteed to hold only if the VRF keys PK and SK were generated in a trustworthy manner.
        </t>
        <t>
        As further discussed in <xref target="untrustedkeys" format="default"/>,
        some VRFs specified in this document satisfy only trusted collision resistance, while others satisfy full collision resistance.
        VRFs in this document that satisfy only trusted collision resistance but not full collision resistance MUST NOT be used if the key generation
        process cannot be trusted.
        </t>
      </section>
      <section anchor="pseudodef" numbered="true" toc="default">
        <name>Full Pseudorandomness or Selective Pseudorandomness</name>
        <t> Pseudorandomness ensures that when an adversarial Verifier sees 
        a VRF hash output beta without its corresponding VRF proof pi, 
        then beta is indistinguishable from a random value.
        </t>
        <t>  More precisely, suppose the public and private VRF keys (PK, SK) were generated
	     in a trustworthy manner.
	     Pseudorandomness ensures that the VRF hash output beta
         (without its corresponding VRF proof pi) on
	     any adversarially-chosen "target" VRF input alpha
	     looks indistinguishable from random
	     for any computationally bounded adversary who does not know the private
         VRF key SK.  This holds even if the adversary also gets to 
         choose other VRF inputs alpha' and observe their corresponding 
         VRF hash outputs beta' and proofs pi'.
        </t>
        <t>   
         With "full pseudorandomness", the adversary is allowed to choose the 
         "target" VRF input  alpha at any time, even after it observes VRF outputs beta'
         and proofs pi' on a variety of chosen inputs alpha'.
        </t>
        <t>
         "Selective pseudorandomness" is a weaker security property
         which suffices in many applications. Here, the adversary must choose
         the target VRF input alpha independently of the public VRF key PK,
         and before it  observes VRF outputs beta'
         and proofs pi' on inputs alpha' of its choice.
        </t>
        <t>
             As further discussed in <xref target="prsecurity" format="default"/>,
             VRFs specified in this document satisfy both full pseudorandomness and selective pseudorandomness,
             but their quantitative security against the selective pseudorandomness attack is stronger.
        </t>
        <t> 
	   It is important to remember that the VRF output beta does not 
	   look random to the Prover, or to any other party that knows the private 
       VRF key SK!  Such a party can easily distinguish beta from 
       a random value by comparing beta to the result of VRF_hash(SK, alpha).	     
        </t>
        <t> Also, the VRF output beta does not look random to any party that
	knows a valid VRF proof pi corresponding to the VRF input alpha, even
	if this party does not know the private VRF key SK.
	Such a party can easily distinguish beta from a random value by
    checking whether VRF_verify(PK, alpha, pi) returns (VALID, beta).
        </t>
        <t>
    Also, the VRF output beta may not look random if VRF key generation
    was not done in a trustworthy fashion. (For example, if VRF keys were 
    generated with bad randomness.)
        </t>
      </section>
      <section anchor="unpred" numbered="true" toc="default">
        <name>Some VRFs: Unpredictability Under Malicious Key Generation</name>
        <t>As explained in <xref target="pseudodef" format="default"/>, pseudorandomness is guaranteed only
       if the VRF keys were generated in a trustworthy fashion.
       For instance, if an adversary outputs VRF keys that are deterministically generated (or hard-coded and publicly known), then the outputs are easily derived by anyone and are therefore not pseudorandom.
        </t>
        <t>There is, however, a different type of unpredictability that is desirable in certain VRF applications (such as leader selection in the consensus protocols of <xref target="GHMVZ17" format="default"/> and <xref target="DGKR18" format="default"/>), called "unpredictability under malicious key generation". This property is similar
       to the unpredictability achieved by an (ordinary, unkeyed)
       cryptographic hash function: if the input has enough entropy (i.e., cannot be predicted), then the correct output is indistinguishable
       from uniform, no matter how the VRF keys are generated.
        </t>
        <t>
       A formal definition of this property appears in Section 3.2 of <xref target="DGKR18" format="default"/>.  The RSA-FDH-VRF presented in this document does not satisfy this property. The ECVRF presented in this document satisfies this property if validate_key parameter given to the ECVRF_verify is TRUE.</t>
      </section>
    </section>
    <section anchor="fdh" numbered="true" toc="default">
      <name>RSA Full Domain Hash VRF (RSA-FDH-VRF)</name>
      <t>
            The RSA Full Domain Hash  VRF (RSA-FDH-VRF) is a VRF that, for suitable key lengths, satisfies
            the "trusted uniqueness", "trusted
            collision resistance", and "full pseudorandomness" properties defined in <xref target="secdef" format="default"/>, as further discussed in <xref target="securitycons" format="default"/>.
            Its security follows from the
            standard RSA assumption in the random oracle model.  Formal
            security proofs are in <xref target="PWHVNRG17" format="default"/>.
      </t>
      <t>
            The VRF computes the proof pi as a deterministic RSA signature on
            input alpha using the RSA Full Domain Hash Algorithm
            <xref target="RFC8017" format="default"/> parametrized with the selected hash algorithm.
            RSA signature verification is used to verify the correctness of the
            proof. The VRF hash output beta is simply obtained by hashing 
            the proof pi with the selected hash algorithm.
      </t>
      <t>
            The key pair for RSA-FDH-VRF MUST be generated in a way that it satisfies
            the conditions specified in Section 3 of <xref target="RFC8017" format="default"/>.
      </t>
      <t>
            In this section, the notation from <xref target="RFC8017" format="default"/> is used.
      </t>
      <t>
            Parameters used:
      </t>
      <ul empty="true" spacing="normal">
        <!-- do not change the names, these are from RFC8017 -->
                <li>(n, e) - RSA public key</li>
        <li>K - RSA private key (its representation is implementation-dependent)</li>
        <li>k - length in octets of the RSA modulus n (k must be less than 2^32)</li>
      </ul>
      <t>
            Fixed options (specified in <xref target="rsavrfSuites" format="default"/>):
      </t>
      <ul empty="true" spacing="normal">
        <li>Hash - cryptographic hash function</li>
        <li>hLen - output length in octets of hash function Hash</li>
        <li>suite_string - an octet string specifying the RSA-FDH-VRF
                ciphersuite, which determines the above options</li>
      </ul>
      <t>
            Primitives used:
      </t>
      <ul empty="true" spacing="normal">
        <li>
                    I2OSP - Conversion of a nonnegative integer to an octet string as defined in
                    Section 4.1 of <xref target="RFC8017" format="default"/>
                    (given an integer and a length in octets, produces a big-endian representation of the integer, zero-padded to the desired length)
                </li>
        <li>
                    OS2IP - Conversion of an octet string to a nonnegative integer as defined in
                    Section 4.2 of <xref target="RFC8017" format="default"/>
                    (given a big-endian encoding of an integer, produces the integer)
                </li>
        <li>
                    RSASP1 - RSA signature primitive as defined in
                    Section 5.2.1 of <xref target="RFC8017" format="default"/> (given a private key and an input, raises the input to the private RSA exponent modulo n)
                </li>
        <li>
                    RSAVP1 - RSA verification primitive as defined in
                    Section 5.2.2 of <xref target="RFC8017" format="default"/> (given a public key and an input, raises the input to the public RSA exponent modulo n)
                </li>
        <li>
                    MGF1 - Mask Generation Function based on the hash function Hash as defined in
                    Section B.2.1 of <xref target="RFC8017" format="default"/> (given an input, produces a random-oracle-like output of desired length)
        </li>
        <li>
                    || - octet string concatenation
                </li>
      </ul>
      <section numbered="true" toc="default">
        <name>RSA-FDH-VRF Proving</name>
        <t>
                RSAFDHVRF_prove(K, alpha_string[, MGF_salt])
        </t>
        <t>
                Input:
        </t>
        <ul empty="true" spacing="normal">
          <li>K - RSA private key</li>
          <li>alpha_string - VRF hash input, an octet string</li>
        </ul>
        
        <t>
                Optional Input:
        </t>
        <ul empty="true" spacing="normal">
          <li>MGF_salt - a public octet string used as a hash function salt; this input is not used when MGF_salt is specified as part of the ciphersuite</li>
        </ul>
        <t>
                Output:
        </t>
        <ul empty="true" spacing="normal">
          <li>pi_string - proof, an octet string of length k</li>
        </ul>
        <t>
                Steps:
        </t>
        <ol spacing="normal" type="1"><li>mgf_domain_separator = 0x01</li>
          <li>EM = MGF1(suite_string || mgf_domain_separator || MGF_salt || alpha_string, k - 1)</li>
          <li>m = OS2IP(EM)</li>
          <li>s = RSASP1(K, m)</li>
          <li>pi_string = I2OSP(s, k)</li>
          <li>Output pi_string</li>
        </ol>
      </section>
      <section numbered="true" toc="default">
        <name>RSA-FDH-VRF Proof to Hash</name>
        <t>
                RSAFDHVRF_proof_to_hash(pi_string)
        </t>
        <t>
                Input:
        </t>
        <ul empty="true" spacing="normal">
          <li>pi_string - proof, an octet string of length k</li>
        </ul>
        <t>
                Output:
        </t>
        <ul empty="true" spacing="normal">
          <li>beta_string - VRF hash output, an octet string of length hLen</li>
        </ul>
        <t>
                Important note:
        </t>
        <ul empty="true" spacing="normal">
          <li>RSAFDHVRF_proof_to_hash should be run only on pi_string that is known to have been produced by RSAFDHVRF_prove, or from within RSAFDHVRF_verify as specified in <xref target="rsaverify" format="default"/>.</li>
        </ul>
        <t>
                Steps:
        </t>
        <ol spacing="normal" type="1"><li>proof_to_hash_domain_separator = 0x02</li>
          <li>beta_string = Hash(suite_string || proof_to_hash_domain_separator || pi_string)</li>
          <li>Output beta_string</li>
        </ol>
      </section>
      <section anchor="rsaverify" numbered="true" toc="default">
        <name>RSA-FDH-VRF Verifying</name>
        <t>
                RSAFDHVRF_verify((n, e), alpha_string, pi_string[, MGF_salt])
        </t>
        <t>
                Input:
        </t>
        <ul empty="true" spacing="normal">
          <li>(n, e) - RSA public key</li>
          <li>alpha_string - VRF hash input, an octet string</li>
          <li>pi_string - proof to be verified, an octet string of length k</li>
        </ul>
        <t>
                Optional Input:
        </t>
        <ul empty="true" spacing="normal">
          <li>MGF_salt - a public octet string used as a hash function salt; this input is not used when MGF_salt is specified as part of the ciphersuite</li>
        </ul>
        <t>
                Output:
        </t>

        <t>
                Output:
        </t>
        <ul empty="true" spacing="normal">
          <li>
            <t>("VALID", beta_string), where beta_string is the VRF hash output, an octet string of length hLen; or
            </t>
            <t>"INVALID"</t>
          </li>
        </ul>
        <t>
                Steps:
        </t>
        <ol spacing="normal" type="1"><li>s = OS2IP(pi_string)</li>
          <li>m = RSAVP1((n, e), s); if RSAVP1 returns "signature representative out of range", output "INVALID" and stop.</li>
          <li>mgf_domain_separator = 0x01</li>
          <li>EM' = MGF1(suite_string || mgf_domain_separator || MGF_salt ||  alpha_string, k - 1)</li>
          <li>m' = OS2IP(EM')</li>
          <li>
                        If m and m' are equal, output ("VALID", RSAFDHVRF_proof_to_hash(pi_string));
                        else output "INVALID".
          </li>
        </ol>
      </section>
      
      <section anchor="rsavrfSuites" numbered="true" toc="default">
      <name>RSA-FDH-VRF Ciphersuites</name>
      <t>This document defines RSA-FDH-VRF-SHA256 as follows:</t>
        <ul spacing="normal">
          <li>suite_string = 0x01</li>
          <li>The hash function Hash is SHA-256 as specified in <xref target="RFC6234" format="default"/>, with hLen = 32</li>
          <li>MGF_salt = I2OSP(k, 4) || I2OSP(n, k)</li>
         </ul>

      <t>This document defines RSA-FDH-VRF-SHA384 as follows:</t>
        <ul spacing="normal">
          <li>suite_string = 0x02</li>
          <li>The hash function Hash is SHA-384 as specified in <xref target="RFC6234" format="default"/>, with hLen = 48</li>
          <li>MGF_salt = I2OSP(k, 4) || I2OSP(n, k)</li>
        </ul>
        
      <t>This document defines RSA-FDH-VRF-SHA512 as follows:</t>
        <ul spacing="normal">
          <li>suite_string = 0x03</li>
          <li>The hash function Hash is SHA-512 as specified in <xref target="RFC6234" format="default"/>, with hLen = 64</li>
          <li>MGF_salt = I2OSP(k, 4) || I2OSP(n, k)</li>
        </ul>

      </section>
    </section>
    
    
    <section anchor="ecvrf" numbered="true" toc="default">
      <name>Elliptic Curve VRF (ECVRF)</name>
      <t>
            The Elliptic Curve Verifiable Random Function (ECVRF) is a VRF that, for suitable parameter choices,
            satisfies the "full uniqueness", "trusted collision resistance",
            and "full pseudorandomness properties" defined in <xref target="secdef" format="default"/>.
            If validate_key parameter given to the ECVRF_verify is TRUE, then
            the ECVRF additionally satisfies "full collision resistance" and "unpredictability under malicious key generation". See <xref target="securitycons" format="default"/>
            for further discussion. Formal security proofs are
            in <xref target="PWHVNRG17" format="default"/>.
      </t>
      <t>
            Notation used:
      </t>
      <ul empty="true" spacing="normal">
        <li>Elliptic curve operations are written in additive notation, with P+Q denoting point addition and x*P denoting scalar multiplication of a point P by a scalar x</li>
        <li>x^y - x raised to the power y</li>
        <li>x*y - x multiplied by y</li>
        <li>s || t - concatenation of octet strings s and t</li>
        <li>0xMN (where M and N are hexadecimal digits) - a single octet with value M*16+N; equivalently, int_to_string(M*16+N, 1), where int_to_string is as defined below.</li>
      </ul>
      <t>
            Fixed options (specified in <xref target="ecvrfSuites" format="default"/>):
      </t>
      <ul empty="true" spacing="normal">
        <li>F - finite field</li>
        <li>fLen - length, in octets, of an element in F encoded as an octet string</li>
        <li>E - elliptic curve (EC) defined over F</li>
        <li>ptLen - length, in octets, of a point on E encoded as an octet string</li>
        <li>G - subgroup of E of large prime order</li>
        <li>q - prime order of group G</li>
        <li>qLen - length of q in octets, i.e., smallest integer such that 2^(8qLen)&gt;q</li>
        <li>cLen - length, in octets, of a challenge value used by the VRF (note that in the typical case, cLen is qLen/2 or close to it)</li>
        <li>cofactor - number of points on E divided by q</li>
        <li>B - generator of group G</li>
        <li>Hash - cryptographic hash function</li>
        <li>hLen - output length in octets of Hash (hLen must be at least cLen; in the typical case, it is at least qLen)</li>
        <li>ECVRF_encode_to_curve - a function that hashes strings to points on E.</li>
        <li>ECVRF_nonce_generation - a function that derives a pseudorandom nonce
                    from SK and the input as part of ECVRF proving.</li>
        <li>suite_string - an octet string specifying the ECVRF
                ciphersuite, which determines the above options as well as type conversions and parameter generation </li>
      </ul>
      <t>
            Type conversions (specified in <xref target="ecvrfSuites" format="default"/>):
      </t>
      <ul empty="true" spacing="normal">
        <li>int_to_string(a, len) - conversion of nonnegative integer a
                    to octet string of length len</li>
        <li> string_to_int(a_string) - conversion of an octet string a_string
                    to a nonnegative integer</li>
        <li>point_to_string - conversion of a point on E to an ptLen-octet string</li>
        <li>string_to_point - conversion of an ptLen-octet string to a point on E.
                    string_to_point returns INVALID if the octet string does not convert to a valid EC point on the curve E.</li>
        <li>
                    Note that with certain software libraries
                    (for big integer and elliptic curve arithmetic),
                    the int_to_string and point_to_string conversions are not needed, when
                    the libraries encode integers and EC points in the same way as required
                    by the ciphersuites.
                    For example, in some implementations, EC point
                    operations will take octet strings as inputs and
                    produce octet strings as outputs, without introducing
                    a separate elliptic curve point type.
                </li>
      </ul>
      <t>
            Parameters used (the generation of these parameters is specified in <xref target="ecvrfSuites" format="default"/>):
      </t>
      <ul empty="true" spacing="normal">
        <li>SK - VRF private key</li>
        <li>x - VRF secret scalar, an integer.
                        Note: depending on the ciphersuite used, the VRF secret scalar may be equal
                        to SK; else, it is derived from SK
                    </li>
        <li>Y = x*B - VRF public key, an point on E</li>
        <li>PK_string = point_to_string(Y) - VRF public key represented as an octet string</li>
        <li>encode_to_curve_salt - a public value used as a hash function salt</li>
      </ul>
      
      <section anchor="ecvrfprove" numbered="true" toc="default">
        <name>ECVRF Proving</name>
        <t>
                ECVRF_prove(SK, alpha_string[, encode_to_curve_salt])
        </t>
        <t>
                Input:
        </t>
        <ul empty="true" spacing="normal">
          <li>SK - VRF private key</li>
          <li>alpha_string - input alpha, an octet string</li>
        </ul>
        
        <t>
                Optional input:
        </t>
        <ul empty="true" spacing="normal">
          <li>encode_to_curve_salt - a public salt value, an octet string; this input is not used when encode_to_curve_salt is specified as part of the ciphersuite</li>
        </ul>

        
        <t>
                Output:
        </t>
        <ul empty="true" spacing="normal">
          <li>pi_string - VRF proof, octet string of length ptLen+cLen+qLen</li>
        </ul>
        <t>
                Steps:
        </t>
        <ol spacing="normal" type="1"><li>
            <t>Use SK to derive the VRF secret scalar x and the VRF public key Y = x*B
            </t>
            <t>(this derivation depends on the ciphersuite, as per  <xref target="ecvrfSuites" format="default"/>;
            </t>
            <t>these values can be cached, for example, after key generation, and need not be rederived each time)</t>
          </li>
          <li>H = ECVRF_encode_to_curve(encode_to_curve_salt, alpha_string) (see <xref target="ecvrfH2C" format="default"/>)</li>
          <li>h_string = point_to_string(H)</li>
          <li>Gamma = x*H</li>
          <li>k = ECVRF_nonce_generation(SK, h_string) (see <xref target="ecvrfNonceGeneration" format="default"/>)</li>
          <li>c = ECVRF_challenge_generation(Y, H, Gamma, k*B, k*H) (see <xref target="ecvrfChallengeGeneration" format="default"/>)</li>
          <li>s = (k + c*x) mod q</li>
          <li>pi_string = point_to_string(Gamma) || int_to_string(c, cLen) || int_to_string(s, qLen)</li>
          <li>Output pi_string</li>
        </ol>
      </section>
      <section numbered="true" toc="default">
        <name>ECVRF Proof to Hash</name>
        <t>
                ECVRF_proof_to_hash(pi_string)
        </t>
        <t>
                Input:
        </t>
        <ul empty="true" spacing="normal">
          <li>pi_string - VRF proof, octet string of length ptLen+cLen+qLen</li>
        </ul>
        <t>
                Output:
        </t>
        <ul empty="true" spacing="normal">
          <li>"INVALID", or </li>
          <li>beta_string - VRF hash output, octet string of length hLen</li>
        </ul>
        <t>
                Important note:
        </t>
        <ul empty="true" spacing="normal">
          <li>ECVRF_proof_to_hash should be run only on pi_string that is known to have been produced by ECVRF_prove, or
                        from within ECVRF_verify as specified in <xref target="ecverify" format="default"/>.</li>
        </ul>
        <t>
                Steps:
        </t>
        <ol spacing="normal" type="1"><li>D = ECVRF_decode_proof(pi_string) (see <xref target="ecvrfDecodeProof" format="default"/>)</li>
          <li>If D is "INVALID", output "INVALID" and stop</li>
          <li>(Gamma, c, s) = D</li>
          <li>proof_to_hash_domain_separator_front = 0x03</li>
          <li>proof_to_hash_domain_separator_back = 0x00</li>
          <li>beta_string = Hash(suite_string || proof_to_hash_domain_separator_front || point_to_string(cofactor * Gamma) || proof_to_hash_domain_separator_back)</li>
          <li>Output beta_string</li>
        </ol>
      </section>
      <section anchor="ecverify" numbered="true" toc="default">
        <name>ECVRF Verifying</name>
        <t>
                ECVRF_verify(PK_string, alpha_string, pi_string[, encode_to_curve_salt, validate_key])
        </t>
        <t>
                Input:
        </t>
        <ul empty="true" spacing="normal">
          <li>PK_string - public key, an octet string</li>
          <li>alpha_string - VRF input, octet string</li>
          <li>pi_string - VRF proof, octet string of length ptLen+cLen+qLen</li>
        </ul>
        <t>
                Optional input:
        </t>
        <ul empty="true" spacing="normal">
          <li>encode_to_curve_salt - a public salt value, an octet string; this input is not used when encode_to_curve_salt is specified as part of the ciphersuite</li>
          <li>validate_key - a boolean. An implementation MAY support only the option of validate_key = TRUE, or only the option of validate_key = FALSE, in which case this input is not needed. If an implementation supports only one option, it MUST specify which option is supports.</li>
        </ul>
        
        <t>
                Output:
        </t>
        <ul empty="true" spacing="normal">
          <li>
            <t>("VALID", beta_string), where beta_string is the VRF hash output, octet string of length hLen; or
            </t>
            <t> "INVALID"</t>
          </li>
        </ul>
 
        <t>
                Steps:
        </t>
        <ol spacing="normal" type="1">
          <li>Y =  string_to_point(PK_string)</li>
          <li>If Y is "INVALID", output "INVALID" and stop</li>
          <li>If validate_key, run ECVRF_validate_key(Y) (<xref target="keycheck" format="default"/>); if it outputs "INVALID", output "INVALID" and stop
          </li>
          <li>D = ECVRF_decode_proof(pi_string) (see <xref target="ecvrfDecodeProof" format="default"/>)</li>
          <li>If D is "INVALID", output "INVALID" and stop</li>
          <li>(Gamma, c, s) = D</li>
          <li>H = ECVRF_encode_to_curve(encode_to_curve_salt, alpha_string) (see <xref target="ecvrfH2C" format="default"/>)</li>
          <li>U = s*B - c*Y</li>
          <li>V = s*H - c*Gamma</li>
          <li>c' = ECVRF_challenge_generation(Y, H, Gamma, U, V) (see <xref target="ecvrfChallengeGeneration" format="default"/>)</li>
          <li>
                        If c and c' are equal, output ("VALID", ECVRF_proof_to_hash(pi_string));
                        else output "INVALID"
                    </li>
        </ol>
        <t>Note that the first three steps need to be performed only once for a given public key.</t>
        
      </section>
      <section numbered="true" toc="default">
        <name>ECVRF Auxiliary Functions</name>
        <section anchor="ecvrfH2C" numbered="true" toc="default">
          <name>ECVRF Encode to Curve</name>
          <t>The ECVRF_encode_to_curve algorithm takes a public salt (see <xref target="salt" format="default"/>) and the VRF input alpha
            and converts it to H, an EC point in G.
            This algorithm is the only place the VRF input alpha is used
            for proving and verifying. See
            <xref target="prehash" format="default"/> for further discussion.
          </t>
          <t>This section specifies a number of such algorithms, which are not compatible with each other and are intended to use with various ciphersuites specified in <xref target="ecvrfSuites" format="default"/>.</t>
              
          <t>
                Input:
          </t>
          <ul empty="true" spacing="normal">
            <li>encode_to_curve_salt - public salt value, an octet string</li>
            <li>alpha_string - value to be hashed, an octet string</li>
          </ul>
          <t>
               Output:
          </t>
          <ul empty="true" spacing="normal">
              <li>H - hashed value, a point in G </li>
          </ul>

          <section anchor="ecvrfH2C1" numbered="true" toc="default">
            <name>ECVRF_encode_to_curve_try_and_increment</name>
            <t>
            The following ECVRF_encode_to_curve_try_and_increment(encode_to_curve_salt, alpha_string) algorithm
            implements ECVRF_encode_to_curve in a simple and
            generic way that works for any elliptic curve. To use this algorithm,
            hLen MUST be at least fLen.
            </t>
            <t>
            The running time of this algorithm depends on alpha_string.
            For the ciphersuites specified 
            in <xref target="ecvrfSuites" format="default"/>, this algorithm
            is expected to find a valid curve point after approximately two attempts 
            (i.e., when ctr=1) on average.
            </t>
            <t>
            However, because the running time of algorithm depends on alpha_string,
            this algorithm SHOULD be avoided in 
            applications where it is important that
            the VRF input alpha remain secret. 
            </t>
            <t>
                ECVRF_encode_to_curve_try_and_increment(encode_to_curve_salt, alpha_string)
            </t>
            <t>
                Fixed option  (specified in <xref target="ecvrfSuites" format="default"/>):
            </t>
            <ul empty="true" spacing="normal">
              <li>interpret_hash_value_as_a_point - a function that attempts to convert a cryptographic hash value to a point on E; may output INVALID.</li>
            </ul>
            <t>
                Steps:
            </t>
            <ol spacing="normal" type="1"><li>ctr = 0</li>
              <li>encode_to_curve_domain_separator_front = 0x01</li>
              <li>encode_to_curve_domain_separator_back = 0x00</li>
              <li>H = "INVALID"</li>
              <li>
                <t>While H is "INVALID" or H is the identity element of the elliptic curve group:
                </t>
                <ol spacing="normal" type="a"><li>ctr_string = int_to_string(ctr, 1)</li>
                  <li>hash_string = Hash(suite_string || encode_to_curve_domain_separator_front || encode_to_curve_salt || alpha_string || ctr_string || encode_to_curve_domain_separator_back)</li>
                  <li>H = interpret_hash_value_as_a_point(hash_string)</li>
                  <li>If H is not "INVALID" and cofactor &gt; 1, set H = cofactor * H</li>
                  <li>ctr = ctr + 1</li>
                </ol>
              </li>
              <li>Output H</li>
            </ol>
            <t>
            Note even though the loop is infinite as written, and int_to_string(ctr,1) may fail when ctr reaches 256,
            interpret_hash_value_as_a_point functions specified in <xref target="ecvrfSuites" format="default"/>
            will succeed on roughly half hash_string values. Thus the loop is expected to stop after two iterations, and ctr is overwhelmingly unlikely (probability about 2^-256) to reach 256.
            </t>
          </section>
          <section anchor="h2csuite" numbered="true" toc="default">
            <name>ECVRF_encode_to_curve_h2c_suite</name>
            <t>The ECVRF_encode_to_curve_h2c_suite(encode_to_curve_salt, alpha_string) algorithm
                implements ECVRF_encode_to_curve using one of the several
                hash-to-curve options defined in
                <xref target="I-D.irtf-cfrg-hash-to-curve" format="default"/>.
                The specific choice of the hash-to-curve option
                (called Suite ID in <xref target="I-D.irtf-cfrg-hash-to-curve" format="default"/>)
                is given by the h2c_suite_ID_string parameter.
            </t>
            <t>
                ECVRF_encode_to_curve_h2c_suite(encode_to_curve_salt, alpha_string)
            </t>
            <t>
                Fixed option (specified in <xref target="ecvrfSuites" format="default"/>):
            </t>
            <ul empty="true" spacing="normal">
              <li>h2c_suite_ID_string - a hash-to-curve suite ID, encoded in ASCII (see discussion below)</li>
            </ul>
            <t>
                Steps:
            </t>
            <ol spacing="normal" type="1">
              <li>string_to_be_hashed = encode_to_curve_salt || alpha_string</li>
              <li>
                <t>H = encode(string_to_be_hashed)
                </t>
                <t>(the encode function is discussed below) </t>
              </li>
              <li>Output H</li>
            </ol>
            <t>The encode function is provided by the hash-to-curve suite whose ID is h2c_suite_ID_string, as specified in
                <xref target="I-D.irtf-cfrg-hash-to-curve" format="default"/>, Section 8.
                The domain separation tag DST, a parameter to the hash-to-curve suite, SHALL be set to
            </t>
            <ul empty="true" spacing="normal">
              <li>
                    "ECVRF_" || h2c_suite_ID_string || suite_string
                </li>
            </ul>
            <t>
                where "ECVRF_" is represented as a 6-byte ASCII encoding (in hexadecimal, octets 45 43 56 52 46 5F).
            </t>
          </section>
        </section>
        <section anchor="ecvrfNonceGeneration" numbered="true" toc="default">
          <name>ECVRF Nonce Generation</name>
          <t>The following algorithms generate the
        nonce value k in a deterministic pseudorandom fashion.
            This section specifies a number of such algorithms, which are not compatible with each other.
            The choice of a particular algorithm from the options specified in this section depends on the ciphersuite, as specified in <xref target="ecvrfSuites" format="default"/>.</t>
          <section anchor="nonceP256" numbered="true" toc="default">
            <name>ECVRF Nonce Generation from RFC 6979</name>
            <t>
                    ECVRF_nonce_generation_RFC6979(SK, h_string)
            </t>
            <t>
                    Input:
            </t>
            <ul empty="true" spacing="normal">
              <li>SK - an ECVRF secret key</li>
              <li>h_string - an octet string</li>
            </ul>
            <t>
                    Output:
            </t>
            <ul empty="true" spacing="normal">
              <li>k - an integer nonce between 1 and q-1</li>
            </ul>
            <t>
                    The ECVRF_nonce_generation function is as specified in 
                    <xref target="RFC6979" format="default"/> Section 3.2 where
            </t>
            <ul empty="true" spacing="normal">
              <li> Input m is set equal to h_string</li>
              <li> The "suitable for DSA or ECDSA" check in step h.3 is omitted</li>
              <li> The hash function H is Hash and its output length hlen (in bits) is set as hLen*8</li>
              <li> The secret key x is set equal to the VRF secret scalar x </li>
              <li> The prime q is the same as in this specification</li>
              <li> qlen is the binary length of q, i.e., the smallest integer such that 2^qlen &gt; q (this qlen is not to be confused with qLen in this document, which is the length of q in octets)</li>
              <li> All the other values and primitives as defined in <xref target="RFC6979" format="default"/> </li>
            </ul>
          </section>
          <section anchor="nonce25519" numbered="true" toc="default">
            <name>ECVRF Nonce Generation from RFC 8032</name>
            <t> The following is from Steps 2-3 of Section 5.1.6
                in <xref target="RFC8032" format="default"/>. To use this algorithm, hLen MUST be at least 64.
            </t>
            <t>
                    ECVRF_nonce_generation_RFC8032(SK, h_string)
            </t>
            <t>
                    Input:
            </t>
            <ul empty="true" spacing="normal">
              <li>SK - an ECVRF secret key</li>
              <li>h_string - an octet string</li>
            </ul>
            <t>
                    Output:
            </t>
            <ul empty="true" spacing="normal">
              <li>k - an integer nonce between 0 and q-1</li>
            </ul>
            <t>
                    Steps:
            </t>
            <ol spacing="normal" type="1"><li>hashed_sk_string = Hash(SK)</li>
              <li>truncated_hashed_sk_string = hashed_sk_string[32]...hashed_sk_string[63]</li>
              <li>k_string = Hash(truncated_hashed_sk_string || h_string)</li>
              <li>k = string_to_int(k_string) mod q</li>
            </ol>
          </section>
        </section>
        <section anchor="ecvrfChallengeGeneration" numbered="true" toc="default">
          <name>ECVRF Challenge Generation</name>
          <t>
                ECVRF_challenge_generation(P1, P2, P3, P4, P5)
          </t>
          <t>
                Input:
          </t>
          <ul empty="true" spacing="normal">
            <li>P1, P2, P3, P4, P5 - EC points</li>
          </ul>
          <t>
                Output:
          </t>
          <ul empty="true" spacing="normal">
            <li>c - challenge value, integer between 0 and 2^(8*cLen)-1</li>
          </ul>
          <t>
                Steps:
          </t>
          <ol spacing="normal" type="1"><li>challenge_generation_domain_separator_front = 0x02</li>
            <li>Initialize str = suite_string || challenge_generation_domain_separator_front </li>
            <li>
              <t>for PJ in [P1, P2, P3, P4, P5]:
              </t>
              <t>str = str || point_to_string(PJ)
              </t>
            </li>
            <li>challenge_generation_domain_separator_back = 0x00</li>
            <li>str = str || challenge_generation_domain_separator_back</li>
            <li>c_string = Hash(str)</li>
            <li>truncated_c_string = c_string[0]...c_string[cLen-1]
                    <!--(first cLen octets of c_string)-->
            </li>
            <li>c = string_to_int(truncated_c_string)</li>
            <li>Output c</li>
          </ol>
        </section>
        <section anchor="ecvrfDecodeProof" numbered="true" toc="default">
          <name>ECVRF Decode Proof</name>
          <t>
                ECVRF_decode_proof(pi_string)
          </t>
          <t>
                Input:
          </t>
          <ul empty="true" spacing="normal">
            <li>pi_string - VRF proof, octet string (ptLen+cLen+qLen octets)</li>
          </ul>
          <t>
                Output:
          </t>
          <ul empty="true" spacing="normal">
            <li>"INVALID", or </li>
            <li>Gamma - a point on E</li>
            <li>
                    c - integer between 0 and 2^(8*cLen)-1
                    </li>
            <li>
                    s - integer between 0 and q-1
                    </li>
          </ul>
          <t>
                Steps:
          </t>
          <ol spacing="normal" type="1"><li>gamma_string = pi_string[0]...pi_string[ptLen-1]</li>
            <li>c_string = pi_string[ptLen]...pi_string[ptLen+cLen-1]</li>
            <li>s_string = pi_string[ptLen+cLen]...pi_string[ptLen+cLen+qLen-1]</li>
            <li>Gamma = string_to_point(gamma_string)</li>
            <li>if Gamma = "INVALID" output "INVALID" and stop</li>
            <li>c = string_to_int(c_string)</li>
            <li>s = string_to_int(s_string)</li>
            <li>if s &gt;= q output "INVALID" and stop</li>
            <li>Output Gamma, c, and s</li>
          </ol>
        </section>
        
          <section anchor="keycheck" numbered="true" toc="default">
            <name>ECVRF Validate Key</name>
            <t>
                  ECVRF_validate_key(Y)
            </t>
            <t>
                  Input:
            </t>
            <ul empty="true" spacing="normal">
              <li>Y - public key, a point on E</li>
            </ul>
            <t>
                  Output:
            </t>
            <ul empty="true" spacing="normal">
              <li>"VALID" or "INVALID"</li>
            </ul>
            
            <t>
            Important note: the public key Y given to this procedure MUST be a valid point on E.
            </t>
            
            <t>
            Steps:
            </t>
            <ol spacing="normal" type="1">
              <li>Let Y' = cofactor*Y</li>
              <li>If Y' is the identity element of the elliptic curve group, output "INVALID" and stop</li>
              <li>Output "VALID"</li>
            </ol>
                
                <t>Note that if the cofactor = 1, then Step 1 simply sets Y'=Y. In particular, for the P-256 curve, ECVRF_validate_key simply ensures that Y is not the point at infinity.</t>
                <t>
                Any algorithm with identical input-output behavior MAY be used in place of the above steps. For example, if the total number
                  of Y values that could cause Step 2 to output "INVALID" is small, it may be more efficient to simply
                  check Y against a fixed list of such values. For example, the following algorithm MAY be used for the edwards25519 curve:
            </t>
            <ol spacing="normal" type="1">
              <li>PK_string = point_to_string(Y)</li>
              <li>oneTwentySeven_string = 0x7F</li>
              <li>
                <t>y_string[31] = y_string[31] &amp; oneTwentySeven_string
                </t>
                <t>(this step clears the high-order bit of octet 31)</t>
              </li>
              <li>bad_pk[0] = int_to_string(0, 32)</li>
              <li>bad_pk[1] = int_to_string(1, 32)</li>
              <li>bad_y2 = 2707385501144840649318225287225658788936804267575313519463743609750303402022</li>
              <li>bad_pk[2] = int_to_string(bad_y2, 32)</li>
              <li>bad_pk[3] = int_to_string(p-bad_y2, 32)</li>
              <li>bad_pk[4] = int_to_string(p-1, 32)</li>
              <li>bad_pk[5] = int_to_string(p, 32)</li>
              <li>bad_pk[6] = int_to_string(p+1, 32)</li>
              <li>If y_string is in the list [bad_pk[0],...,bad_pk[6]], output "INVALID" and stop</li>
              <li>Output "VALID"</li>
            </ol>
            <t>
                  (This algorithm works for the following reason. Note that there are 8 bad points -- namely, the points whose order is 1, 2, 4, or 8 -- on the edwards25519 curve. Their y coordinates happen to be 0 (two points of order 4), 1 (one point of order 1), bad_y2 (two points of order 8), p-bad_y2 (two points of order 8), and p-1 (one point of order 2). They can obtained by converting the points specified in <xref target="X25519" format="default"/> to Edwards coordinates. Thus, bad_pk[0] (of order 4), bad_pk[2] (of order 8), and bad_pk[3] (of order 8) each match two bad points, depending on the sign of the x-coordinate, which was cleared in step 3, in order to make sure that it does not affect the comparison. bad_pk[1] (of order 1) and bad_pk[4] (of order 2) each match one bad point, because x-coordinate is 0 for these two points. Note that the first 5 list elements cover the 8 bad points. However, in case the y-coordinate of the public key Y had not been modular reduced by p, the list also includes bad_pk[5] and bad_pk[6], which are simply bad_pk[0] and bad_pk[1] shifted by p. There is no need to shift the other bad_pk values by p (or any bad_pk values by a larger multiple of p), because their y coordinate would exceed 2^255; and we ensure that y_string corresponds to an integer less than 2^255 in step 3.)
            </t>
        </section>
        <!-- Untrusted keys -->

      </section>
      <!-- Auxiliary Functions -->

        <section anchor="ecvrfSuites" numbered="true" toc="default">
        <name>ECVRF Ciphersuites</name>
        <t>This document defines ECVRF-P256-SHA256-TAI as follows:
        </t>
        <ul spacing="normal">
          <li>
        suite_string = 0x01.</li>
          <li>
            The EC group G is the NIST P-256 elliptic curve, with curve parameters
            as specified in <xref target="FIPS-186-4" format="default"/> (Section D.1.2.3)
            and <xref target="RFC5114" format="default"/>  (Section 2.6). For this group,
             fLen = qLen = 32 and cofactor = 1.
        </li>
          <li>
              cLen = 16.
          </li>
          <li> The key pair generation primitive is specified in
            Section 3.2.1 of <xref target="SECG1" format="default"/> (q, B, SK, and Y in this document
            correspond to n, G, d, and Q in Section 3.2.1 of <xref target="SECG1" format="default"/>).
            In this ciphersuite, the secret scalar x is equal to the private key SK.
          </li>
          <li> encode_to_curve_salt = PK_string</li>
          <li> The ECVRF_nonce_generation function is as specified in <xref target="nonceP256" format="default"/>.</li>
          <li>The int_to_string function is the I2OSP function specified in Section 
        4.1 of <xref target="RFC8017" format="default"/>. (This is big-endian representation.)</li>
          <li>The string_to_int function is the OS2IP function specified in Section 
        4.2 of <xref target="RFC8017" format="default"/>. (This is big-endian representation.)</li>
          <li>
            The point_to_string function converts a point on E to an octet string
            according to the encoding specified in Section 2.3.3 of 
            <xref target="SECG1" format="default"/> with point compression on.
            This implies ptLen = fLen + 1 = 33.
            (Note that certain software implementations do not introduce a
             separate elliptic curve point type and instead directly treat the
             EC point as an octet string per above encoding. When using such 
             an implementation, the point_to_string function 
             can be treated as the identity function.)
        </li>
          <li> The string_to_point function converts an octet string to an 
            a point on E according to the encoding specified in Section 2.3.4 of
            <xref target="SECG1" format="default"/>. This function MUST output INVALID if
            the octet string does not decode to a point on the curve E.
        </li>
          <li>
            The hash function Hash is SHA-256 as specified in <xref target="RFC6234" format="default"/>, with hLen = 32.
        </li>
          <li>
            The ECVRF_encode_to_curve function is as specified in <xref target="ecvrfH2C1" format="default"/>, with interpret_hash_value_as_a_point(s) = string_to_point(0x02 || s).
        </li>
        </ul>
        <t>This document defines ECVRF-P256-SHA256-SSWU as identical to ECVRF-P256-SHA256-TAI, except that:
        </t>
        <ul spacing="normal">
          <li> suite_string = 0x02.</li>
          <li>the ECVRF_encode_to_curve function is as specified in <xref target="h2csuite" format="default"/>
                        with h2c_suite_ID_string = P256_XMD:SHA-256_SSWU_NU_
                        (the suite is defined in <xref target="I-D.irtf-cfrg-hash-to-curve" format="default"/> Section 8.2)</li>
        </ul>
        <t>This document defines ECVRF-EDWARDS25519-SHA512-TAI as follows:
        </t>
        <ul spacing="normal">
          <li>
        suite_string = 0x03.</li>
          <li>
            The EC group G is the edwards25519
            elliptic curve with parameters defined in Table 1 of
             <xref target="RFC8032" format="default"/>.       
            For this group, fLen = qLen = 32 and cofactor = 8.
        </li>
          <li>
              cLen = 16.
          </li>
          <li> The private key and generation of the secret scalar and the public 
        key are specified in Section 5.1.5 of <xref target="RFC8032" format="default"/>.</li>
          <li> encode_to_curve_salt = PK_string</li>
          <li> The ECVRF_nonce_generation function is as specified in <xref target="nonce25519" format="default"/>.</li>
          <li>The int_to_string function as specified in the first paragraph of
        Section 5.1.2 of <xref target="RFC8032" format="default"/>. (This is little-endian representation.)</li>
          <li>The string_to_int function interprets the string as an integer in little-endian
       representation.</li>
          <li> The point_to_string function converts an point on E to an
            octet string according to the encoding specified
             in Section 5.1.2 of <xref target="RFC8032" format="default"/>. 
            This implies ptLen = fLen = 32.
            (Note that certain software implementations do not introduce a
             separate elliptic curve point type and instead directly treat the
             EC point as an octet string per above encoding. When using such
             and implementation, the point_to_string 
             function can be treated as the identity function.)
        </li>
          <li> The string_to_point function converts an octet string to a point on E
        according to the encoding specified in Section 5.1.3 
        of <xref target="RFC8032" format="default"/>.  This function MUST output INVALID if
            the octet string does not decode to a point on the curve E.
        </li>
          <li>
            The hash function Hash is SHA-512 as specified in <xref target="RFC6234" format="default"/>, with hLen = 64.
        </li>
          <li>
            The ECVRF_encode_to_curve function is as specified in <xref target="ecvrfH2C1" format="default"/>, with interpret_hash_value_as_a_point(s) = string_to_point(s[0]...s[31]).
        </li>
        </ul>
        <t>This document defines ECVRF-EDWARDS25519-SHA512-ELL2 as identical to ECVRF-EDWARDS25519-SHA512-TAI, except:
    
        </t>
        <ul spacing="normal">
          <li>
            suite_string = 0x04.
        </li>
          <li>the ECVRF_encode_to_curve function is as specified in <xref target="h2csuite" format="default"/> with
            h2c_suite_ID_string = edwards25519_XMD:SHA-512_ELL2_NU_
            (the suite is defined in
            <xref target="I-D.irtf-cfrg-hash-to-curve" format="default"/> Section 8.5).
        </li>
        </ul>
      </section>
    </section>

    <section anchor="imp" numbered="true" toc="default">
      <name>Implementation Status</name>
      <t>
            Note to RFC editor: Remove before publication
      </t>
      <t>
    A reference C++ implementation of ECVRF-P256-SHA256-TAI, ECVRF-P256-SHA256-SSWU, ECVRF-EDWARDS25519-SHA512-TAI, and ECVRF-EDWARDS25519-SHA512-ELL2
    is available at <eref target="https://github.com/reyzin/ecvrf"/>. This implementation is neither secure nor especially efficient, but can be used to generate
        test vectors.
      </t>
      <t>
      A Python implementation of an older version of ECVRF-EDWARDS25519-SHA512-ELL2 from the -05 version of this draft is available at <eref target="https://github.com/integritychain/draft-irtf-cfrg-vrf-05"/>.
      </t>
      <t>
      A C implementation of an older version of ECVRF-EDWARDS25519-SHA512-ELL2 from the -03 version of this draft is available at <eref target="https://github.com/algorand/libsodium/tree/draft-irtf-cfrg-vrf-03/src/libsodium/crypto_vrf/ietfdraft03"/>.
      </t>
      <t>
      A Rust implementation of an older version of ECVRF-P256-SHA256-TAI from the -05 version of this draft, as well as variants for the sect163k1 and secp256k1 curves, is available at <eref target="https://crates.io/crates/vrf"/>.
      </t>
      <t>
      A C implementation of a variant of ECVRF-P256-SHA256-TAI from the -05 version of this draft adapted for the secp256k1 curve is available at <eref target="https://github.com/aergoio/secp256k1-vrf"/>.
      </t>
      <t>
            An implementation of an earlier version of RSA-FDH-VRF (SHA-256) and ECVRF-P256-SHA256-TAI was
            first developed
            as a part of the NSEC5 project <xref target="I-D.vcelak-nsec5" format="default"/> and is available
            at <eref target="http://github.com/fcelda/nsec5-crypto"/>.
      </t>
      <t>
    The Key Transparency project at Google
    uses a VRF implementation that is similar to
    the ECVRF-P256-SHA256-TAI, with a few changes
    including the use of SHA-512 instead of SHA-256. Its implementation
    is available at <eref target="https://github.com/google/keytransparency/blob/master/core/crypto/vrf/"/>
      </t>
      <t>
    An implementation by Ryuji Ishiguro following an older version of ECVRF-EDWARDS25519-SHA512-TAI from the -00 version of this draft is available at
    <eref target="https://github.com/r2ishiguro/vrf"/>.
      </t>
      <t>
    An implementation similar to ECVRF-EDWARDS25519-SHA512-ELL2 (with some changes, including the use of SHA-3) is available as part of the
    CONIKS implementation in Golang at 
    <eref target="https://github.com/coniks-sys/coniks-go/tree/master/crypto/vrf"/>.
      </t>
      <t>
    Open Whisper Systems also uses a VRF similar to
    ECVRF-EDWARDS25519-SHA512-ELL2, called VXEdDSA, and specified here
    <eref target="https://whispersystems.org/docs/specifications/xeddsa/"/>
    and here <eref target="https://moderncrypto.org/mail-archive/curves/2017/000925.html"/>.
    Implementations in C and Java are available at <eref target="https://github.com/signalapp/curve25519-java"/> and
    <eref target="https://github.com/wavesplatform/curve25519-java"/>.
    
      </t>
    </section>
    <section anchor="securitycons" numbered="true" toc="default">
      <name>Security Considerations</name>
      <section numbered="true" toc="default">
        <name>Key Generation</name>
        <t>Applications that use the VRFs defined in this
    document MUST ensure that the VRF key is generated correctly,
    using good randomness.
        </t>
        
        <section anchor="untrustedkeys" numbered="true" toc="default">
          <name>Uniqueness and collision resistance with untrusted keys</name>
          <t>The RSA-FDH-VRF satisfies the "trusted uniqueness" (see <xref target="uniqueness" format="default"/>)
              and "trusted collision resistance"
              (see <xref target="collisionresistance" format="default"/>) properties
    as long as the VRF keys are generated correctly.
    Uniqueness and collision resistance may not hold if the keys are generated adversarially
    (specifically, if the RSA function specified in the public key is not bijective because the modulus n or the exponent e are chosen not in compliance with the stadnard); thus,
    RSA-FDH-VRF defined in this document does not have "full uniqueness" and "full collision resistance".
    Therefore, if adversarial key generation is a concern, the
    RSA-FDH-VRF has to be enhanced by additional cryptographic checks
    that its public key has the right form.  These enhacements are left for future specification.
          </t>

          
          
          <t>For the ECVRF, the Verifier MUST obtain E and B from a trusted source, such as a ciphersuite specification, rather than from the prover. If the verifier does so, then the
              ECVRF
    satisfies the "full uniqueness" (see <xref target="uniqueness" format="default"/>)
    and "trusted collision resistance" (see <xref target="collisionresistance" format="default"/>) properties. It additonally satisfies "full collision resistance" if validate_key parameter given to the ECVRF_verify is TRUE.
          </t>
        </section>

        <section numbered="true" toc="default">
          <name>Pseudorandomness with untrusted keys</name>
          <t> Without good randomness, the "pseudorandomness"
    properties of the VRF may not hold. Note that it is not possible to guarantee 
    pseudorandomness in the face of adversarially generated VRF keys.  This is
    because an adversary can always use bad randomness to generate the VRF keys, 
    and thus, the VRF output may not be pseudorandom.
          </t>
        </section>
      </section>

      <section anchor="seclevel" numbered="true" toc="default">
        <name>Security Levels</name>
        
        
        <t>
            As shown in <xref target="PWHVNRG17" format="default"/>, RSA-FDH-VRF satifies the trusted uniqueness property unconditionally. The security level of the RSA-FDH-VRF, measured in bits, for the other two properties is as follows (in the random oracle model for the functions MGF1 and Hash):
        </t>
            <ul>
                <li>For trusted collision resistance: approximately 8*min(k/2, hLen/2) (as shown in <xref target="PWHVNRG17" format="default"/>).</li>
                <li>For selective pseudorandomness: approximately as strong as the security, in bits, of the RSA problem for the key (n, e) (as shown in <xref target="GNPRVZ15" format="default"/>).</li>
            </ul>
        <t>
            As shown in <xref target="PWHVNRG17" format="default"/>, the security level of the ECVRF, measured in bits, is as follows (in the random oracle model for the functions Hash and ECVRF_encode_to_curve):
        </t>
            <ul>
                <li>For trusted uniqueness: approximately 8*min(qLen, cLen).</li>
                <li>For collision resistance (trusted or full, depending on whether validation is performed as explained in <xref target="untrustedkeys" format="default"/>): approximately 8*min(qLen/2, hLen/2).</li>
                <li>For the selective pseudorandomness property: approximately as strong as the security, in bits, of the decisional Diffie-Hellman problem in the group G (which is at most 8*qLen/2).</li>
            </ul>
            <t>See <xref target="secdef" format="default"/> for the definitions of these security properties. See <xref target="prsecurity" format="default"/> for the discussion of full pseudorandomness.</t>
      </section>
      
      <section anchor="prsecurity" numbered="true" toc="default">
        <name>Selective vs. Full Pseudorandomness</name>
        <t><xref target="PWHVNRG17" format="default"/> presents cryptographic reductions to an
    underlying hard problem (namely, the RSA problem for RSA-FDH-VRF
    and the Decisional Diffie-Hellman problem for the ECVRF)
    to prove that the VRFs specified in this
    document possess not only selective pseudorandomness, but also
    full pseudorandomness
    (see <xref target="pseudodef" format="default"/> for an explanation of these notions).
    However, the cryptographic reductions are tighter for selective
    pseudorandomness than for full pseudorandomness. Specifically, the approximate provable security level, measured in bits,
    for full pseudorandomness may be obtained from the provable security level for selective pseudorandomness (given in <xref target="seclevel" format="default"/>) by subtracting the binary logarithm
    of the number of proofs produced for a given secret key. This holds for both the RSA-FDH-VRF and the ECVRF.
        </t>
        
        <t>While no known attacks against full pseudorandomness are stronger than similar attacks against selective pseudorandomness, some applications may be concerned about tightness of cryptographic
    reductions. Such applications may consider the following two options:
        </t>
        <ul spacing="normal">
          <li> They may choose to ensure that selective pseudorandomness is sufficient for
    the application. That is, that
	pseudorandomness of outputs matters only for inputs that are chosen
    independently of the VRF key. 
    </li>
          <li>They
    may increase
    security parameters to make up for the loose security reduction. 
    For RSA-FDH-VRF, this means increasing the RSA key length. For 
    ECVRF, this means increasing the cryptographic strength of the EC group
    G by specifying a new ciphersuite.
    </li>
        </ul>
      </section>
      <section numbered="true" toc="default">
        <name>Proper pseudorandom nonce for ECVRF</name>
        <t>
    The security of the ECVRF defined in this document relies on the 
    fact that the nonce k used in the ECVRF_prove algorithm is
    chosen uniformly and pseudorandomly modulo q, and is unknown to the adversary.
    Otherwise, an adversary may be able to recover
    the private VRF key x (and thus break pseudorandomness of the VRF)
    after observing several valid VRF proofs pi. The nonce generation methods
    specified in the ECVRF ciphersuites of <xref target="ecvrfSuites" format="default"/>
    are designed with this requirement in mind.
        </t>
      </section>
      <section numbered="true" toc="default">
        <name>Side-channel attacks</name>
        <t>Side channel attacks on cryptographic primitives are an important issue.
        Implementers should
       take care to avoid side-channel attacks that leak information about
       the VRF private key SK (and the nonce k used in the ECVRF), which is
       used in VRF_prove.
       In most applications, VRF_proof_to_hash and VRF_verify
       algorithms take only inputs that are public, and thus side channel
       attacks are typically not a concern for these algorithms.
        </t>
        <t>
    The VRF input alpha may be also a sensitive input to VRF_prove and may
    need to be protected against side channel attacks.
    Below we discuss one particular class of such attacks: timing attacks that can
    be used to leak information about the VRF input alpha.
        </t>
        <t>The ECVRF_encode_to_curve_try_and_increment algorithm defined in
    <xref target="ecvrfH2C1" format="default"/> SHOULD NOT be used in applications where
    the VRF input alpha is secret and is hashed by the VRF on-the-fly.
    This is because the algorithm's running time depends
    on the VRF input alpha, and thus creates a timing channel that
    can be used to learn information about alpha. 
    That said, for most inputs the amount of information obtained from
    such a timing attack is likely to be small (1 bit, on average), since the algorithm 
    is expected to find a valid curve point after only two attempts.  
    However, there might be inputs which cause the algorithm to make many attempts
    before it finds a valid curve point; for such inputs, the information leaked
    in a timing attack will be more than 1 bit. 
        </t>
        <t>ECVRF-P256-SHA256-SSWU and ECVRF-EDWARDS25519-SHA512-ELL2 can be made to
        run in time independent of alpha, following recommendations in <xref target="I-D.irtf-cfrg-hash-to-curve" format="default"/>.
        </t>
        <t>
        
        </t>
      </section>
      <section numbered="true" toc="default">
        <name>Proofs provide no secrecy for the VRF input</name>
        <t>The VRF proof pi is not designed to provide secrecy and, in general, 
        may reveal the VRF input alpha.
        Anyone who knows PK and pi is able to perform an offline
        dictionary attack to search for alpha, by verifying guesses for alpha using VRF_verify.
        This is in contrast to the VRF hash output beta which, without the proof, is pseudorandom
        and thus is designed to reveal no information about alpha.
        </t>
      </section>
      
      <section anchor="prehash" numbered="true" toc="default">
        <name>Prehashing</name>
        <t>The VRFs specified in this document allow for read-once access to
        the input alpha for both signing and verifying. Thus, additional 
        prehashing of alpha (as specified, for example, in
        <xref target="RFC8032" format="default"/> for EdDSA signatures) is not needed, 
        even for applications that need to handle long alpha or
        to support the
        Initialize-Update-Finalize (IUF) interface (in such an interface,
        alpha is not supplied
        all at once, but rather in pieces by a sequence of calls to Update).
        The ECVRF, in particular, uses alpha only in
        ECVRF_encode_to_curve. The curve point H becomes the representative
        of alpha thereafter.</t>
      </section>
        
      <section anchor="domainsep" numbered="true" toc="default">
        <name>Hash function domain separation</name>
        <t>
         Hashing is used for different purposes in the two VRFs (namely, in the RSA-FDH-VRF, in MGF1 and in proof_to_hash; in the ECVRF, in encode_to_curve, nonce_generation, challenge_generation, and proof_to_hash). The
         theoretical analysis treats each of these functions as a separate hash function, modeled as a random oracle.
         This analysis still holds even if the same hash function is used, as long as the four 
         queries made to the hash function for a given SK and alpha are overwhelmingly unlikely 
         to equal each other or to any queries made to the hash function for the same SK and 
         different alpha. This is indeed the case for the RSA-FDH-VRF defined in this document, because the second octets
         of the input to the hash function used in MGF1 and in proof_to_hash are different.
        </t>
        <t>
         This is also the case for the ECVRF ciphersuites defined in this document, because:
        </t>
        <ul spacing="normal">
          <li>inputs to the hash function used during nonce_generation are unlikely to equal 
          inputs used in encode_to_curve, proof_to_hash, and challenge_generation. This
          follows since nonce_generation inputs a secret to the hash function that is not used by 
          honest parties as input to any other hash function, and is not available to the adversary.</li>
          <li>the second octets of the inputs to the hash function used in
          proof_to_hash, challenge_generation, and encode_to_curve_try_and_increment
          are all different.</li>
          <li>the last octet of the input to the hash function used in
          proof_to_hash, challenge_generation, and encode_to_curve_try_and_increment is always zero,
          and therefore different from the last octet of the input to the hash function used in ECVRF_encode_to_curve_h2c_suite,
          which is set equal to the nonzero length of the domain separation tag by <xref target="I-D.irtf-cfrg-hash-to-curve" format="default"/>.</li>
        </ul>
    </section>
      
        <section anchor="salt" numbered="true" toc="default">
          <name>Hash function salting</name>
        <t>
        In case a hash collision is found, in order to make it more difficult for the adversary to exploit such a collision, the MGF1 function for the RSA-FDH-VRF and ECVRF_encode_to_curve function for the ECVRF use a public value in addition to alpha (as a so-called salt). This value is determined by the ciphersuite. For the ciphersuites defined in this document, it is set equal to the string representation of the RSA modulus and EC public key, respectively. Implementations that do not use one of the ciphersuites (see <xref target="futureproofing" format="default" />) MAY use a different salt. For example, if a group of public keys to share the same salt, then the hash of the VRF input alpha will be the same for the entire group of public keys, which may aid in some protocol that uses the VRF.
        </t>
    </section>
        
        <section anchor="futureproofing" numbered="true" toc="default">
        <name>Futureproofing</name>
        <t>if future designs need to specify variants (e.g., additional ciphersuites) of the RSA-FDH-VRF or the ECVRF in this document,
            then, to avoid the possibility
            that an adversary can obtain a VRF output under one variant, and then claim it was obtained under
            another variant,
           they should specify a different suite_string constant. The suite_string constants in this document are all single octets; if a future suite_string constant is longer than one octet, then it should start with a different octet than the suite_string constants in this document. Then, for the RSA-FDH-VRF, the inputs to the hash function used in MGF1 and proof_to_hash will be different from other ciphersuites.
        For the ECVRF, the inputs
        ECVRF_encode_to_curve hash function used in producing H are then guaranteed to be different from other
        ciphersuites; since all the other hashing done by the prover
        depends on H, inputs to all the hash functions used by the prover will also be
        different from other ciphersuites as long as ECVRF_encode_to_curve is collision resistant.
        </t>
      </section>
    </section>
    <section numbered="true" toc="default">
      <name>Change Log</name>
      <t>
            Note to RFC Editor: if this document does not obsolete an existing RFC,
            please remove this appendix before publication as an RFC.
      </t>
      <ul empty="true" spacing="normal">
        <!--<t>
                    draft-goldbe-vrf-00 - Forked this document from draft-vcelak-nsec5-04. 
                    Cleaned up the definitions of VRF algorithms.
                    Added security definitions for VRF and security considerations.
                    Parameterized ECVRF so it could support curves other than
                    P-256 and Ed25519.
                </t>
                <t>
                    draft-goldbe-vrf-01 - Fixed ECVRF to work when cofactor > 1.  
                    Changed ECVRF_proof_to_hash(pi) so that it outputs a value raised
                    to the cofactor and then processed by the cryptographic hash function Hash. 
                    Included the VRF public key Y as input to the hash function
                    ECVRF_hash_to_curve1.
                    Cleaned up ciphersuites and ECVRF description so that it works with
                    EC point encodings for both P256 and Ed25519 curves.
                    Added ECVRF_validate_key so that ECVRF can satisfy "full
                    uniqueness" and "full collision" resistance.
                    Updated implementation status.
                    Added "an additional pseudorandomness property" to security
                    definitions.
                </t>-->
                <li> 00 - Forked this document from draft-goldbe-vrf-01.</li>
        <li> 01 - Minor updates, mostly highlighting TODO items.</li>
        <li> 02 - Added specification of elligator2 for Curve25519, along
                with ciphersuites for ECVRF-ED25519-SHA512-Elligator.
                Changed 
                ECVRF-ED25519-SHA256 suite_string to ECVRF-ED25519-SHA512. (This change
                made because Ed25519 in <xref target="RFC8032" format="default"/> signatures 
                use SHA512 and not SHA256.) 
                Made ECVRF nonce generation a separate component, so that nonces are deterministic.
                In ECVRF proving, changed + to - (and made corresponding
                verification changes) in order to be consistent with EdDSA and ECDSA.
                Highlighted that ECVRF_hash_to_curve acts like a prehash.
                Added "suites" variable to ECVRF for futureproofing.
                Ensured domain separation for hash functions by modifying hash_points and added
                discussion about domain separation.
                Updated todos in the "additional pseudorandomness property" 
                section. Added a discussion of secrecy into security considerations.
                Removed B and PK=Y from ECVRF_hash_points because they are already present
                via H, which is computed via hash_to_curve using the suite_string (which identifies B) and Y.</li>
        <li> 03 - Changed Ed25519 conversions to little-endian, to match RFC 8032;  added simple key validation for Ed25519; added Simple SWU cipher suite; clarified Elligator and removed the extra x0 bit, to make Montgomery and Edwards Elligator the same; added domain separation for RSA VRF; improved notation throughout; added nonce generation as a section; changed counter in try-and-increment from four bytes to one, to avoid endian issues; renamed try-and-increment ciphersuites to -TAI; added qLen as a separate parameter; changed output length to hLen for ECVRF, to match RSAVRF; made Verify return beta so unverified proofs don't end
                    up in proof_to_hash; added test vectors.</li>
        <li> 04 - Clarified handling of optional arguments x and PK in ECVRF_prove. Edited implementation status to bring it up to date.</li>
        <li> 05 - Renamed ed25519 into the more commonly used edwards25519. Corrected ECVRF_nonce_generation_RFC6979 (thanks to
                    Gorka Irazoqui Apecechea and Mario Cao Cueto for finding the problem) and corresponding test vectors for the P256 suites. Added a reference to the Rust implementation.</li>
        <li> 06 - Made some variable names more descriptive. Added a few implementation references.</li>
        <li> 07 - Incorporated hash-to-curve draft by reference to replace our own Elligator2 and Simple SWU. Clarified discussion of EC parameters and functions. Added a 0 octet to all hashing to enforce domain separation from hashing done inside hash-to-curve.</li>
        <li> 08 - Incorporated suggestions from crypto panel review by Chloe Martindale. Changed Reyzin's affiliation. Updated references.</li>
        <li> 09 - Added a note to remove the implementation page before publication.</li>
        <li> 10 - Added a check in ECVRF_decode_proof to ensure that s is reduced mod q. Connected security properties (Section 3) and security considerations (Section 7) with more cross-references. </li>
        <li> 11 - Processed last call comments. Clarified various notation, including lengths of various parameters for ECVRF; added error handling to RSA-FDH-VRF; added security levels section; clarified full vs trusted uniqueness and full vs selective pseudorandomness; added RSA ciphersuites; made key validation clearer; renamed hash_to_curve to encode_to_curve to be consistent with the hash_to_curve draft; allowed a more general salt in hashing, added the public key as input to ECVRF_challenge_generation, and added an explanation about the salt.</li>
        <li> 12 - Added k_string to edwards25519 test vectors</li>
        <li> 13 - Clarified key validation for edwards25519 and adddressed IRTF Chair comments</li>
      </ul>
    </section>
    <section numbered="true" toc="default">
      <name>Contributors</name>
      <t>
            This document also would not be possible without the work of
            Moni Naor,
            Sachin Vasant, and
            Asaf Ziv. Chloe Martindale provided a thorough cryptographer's review.
            Liliya Akhmetzyanova, Tony Arcieri, Gary Belvin, Mario Cao Cueto, Brian Chen, Sergey Gorbunov, Shumon Huque, Gorka Irazoqui Apecechea, Marek Jankowski,
            Burt Kaliski, David C. Lawerence, Derek Ting-Haye Leung, Antonio Marcedone, Piotr Nojszewski, Chris Peikert, Trevor Perrin, Sam Scott,
            Stanislav Smyshlyaev, Adam Suhl, Nick Sullivan, Christopher Wood,  Jiayu Xu, and Annie Yousar provided
            valuable input to this draft. Riad Wahby helped this document align with draft-irtf-cfrg-hash-to-curve.
      </t>
    </section>
  </middle>
  <back>
    <!-- References Section -->

<!--
     Section 4.7f of [RFC2223bis] specifies the requirements for the
     references sections.  In particular, there MUST be separate lists of
     normative and informative references, each in a separate section.
     The style SHOULD follow that of recently published RFCs.

     In general, each normative reference SHOULD reference the most recent
     version of the specification in question.
-->

    <references>
      <name>References</name>
      <references>
        <name>Normative References</name>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8174.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8017.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.5114.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.6234.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8032.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.6979.xml"/>
        <xi:include href="https://datatracker.ietf.org/doc/bibxml3/draft-irtf-cfrg-hash-to-curve.xml"/>
        <reference anchor="FIPS-186-4" target="https://csrc.nist.gov/publications/detail/fips/186/4/final">
          <front>
            <title>Digital Signature Standard (DSS)</title>
            <author>
              <organization>National Institute for Standards and Technology</organization>
            </author>
            <date year="2013" month="July"/>
          </front>
          <seriesInfo name="FIPS" value="PUB 186-4"/>
        </reference>
        <reference anchor="SECG1" target="http://www.secg.org/sec1-v2.pdf">
          <front>
            <title>SEC 1: Elliptic Curve Cryptography</title>
            <author>
              <organization>Standards for Efficient Cryptography Group (SECG)</organization>
            </author>
            <date year="2009" month="May"/>
          </front>
          <seriesInfo name="Version" value="2.0"/>
        </reference>
      </references>
      <references>
          
        <name>Informative References</name>
        <reference anchor="ANSI.X9-62-2005">
          <front>
            <title>Public Key Cryptography for the Financial Services Industry: The Elliptic Curve Digital Signature Algorithm (ECDSA)</title>
            <author surname="American National Standards Institute">
              <organization/>
            </author>
            <date year="2005"/>
          </front>
          <seriesInfo name="" value="ANSI X9.62"/>
        </reference>

        <reference anchor="DGKR18" target="https://eprint.iacr.org/2017/573">
          <front>
            <title>Ouroboros Praos: An adaptively-secure, semi-synchronous proof-of-stake protocol</title>
            <author initials="B." surname="David">
              <organization/>
            </author>
            <author initials="P." surname="Gazi">
              <organization/>
            </author>
            <author initials="A." surname="Kiayias">
              <organization/>
            </author>
            <author initials="A." surname="Russell">
              <organization/>
            </author>
            <date year="2018"/>
          </front>
          <seriesInfo name="in" value="Advances in Cryptology - EUROCRYPT"/>
        </reference>
        
        <reference anchor="GHMVZ17" target="https://eprint.iacr.org/2017/454">
          <front>
            <title>Algorand: Scaling Byzantine Agreements for Cryptocurrencies</title>
            <author initials="Y." surname="Gilad">
              <organization/>
            </author>
            <author initials="R." surname="Hemo">
              <organization/>
            </author>
            <author initials="Y." surname="Micali">
              <organization/>
            </author>
            <author initials="Y." surname="Vlachos">
              <organization/>
            </author>
            <author initials="Y." surname="Zeldovich">
              <organization/>
            </author>
            <date year="2017"/>
          </front>
          <seriesInfo name="in" value="Proceedings of the 26th Symposium on Operating Systems Principles (SOSP)"/>
        </reference>

        <reference anchor="GNPRVZ15" target="https://eprint.iacr.org/2014/582.pdf">
          <front>
            <title>NSEC5: Provably Preventing
                DNSSEC Zone Enumeration</title>
            <author initials="S." surname="Goldberg">
              <organization/>
            </author>
            <author initials="M." surname="Naor">
              <organization/>
            </author>
            <author initials="D." surname="Papadopoulos">
              <organization/>
            </author>
            <author initials="L." surname="Reyzin">
              <organization/>
            </author>
            <author initials="S." surname="Vasant">
              <organization/>
            </author>
            <author initials="A." surname="Ziv">
              <organization/>
            </author>
            <date year="2015"/>
          </front>
          <seriesInfo name="in" value="NDSS"/>
        </reference>

        <xi:include href="https://datatracker.ietf.org/doc/bibxml3/draft-vcelak-nsec5.xml"/>

        <reference anchor="MRV99" target="https://dash.harvard.edu/handle/1/5028196">
          <front>
            <title>Verifiable Random Functions</title>
            <author initials="S." surname="Micali">
              <organization/>
            </author>
            <author initials="M." surname="Rabin">
              <organization/>
            </author>
            <author initials="S." surname="Vadhan">
              <organization/>
            </author>
            <date year="1999"/>
          </front>
          <seriesInfo name="in" value="FOCS"/>
        </reference>

        <reference anchor="PWHVNRG17" target="https://eprint.iacr.org/2017/099">
          <front>
            <title>Making NSEC5 Practical for DNSSEC</title>
            <author initials="D." surname="Papadopoulos">
              <organization/>
            </author>
            <author initials="D." surname="Wessels">
              <organization/>
            </author>
            <author initials="S." surname="Huque">
              <organization/>
            </author>
            <author initials="J." surname="Vcelak">
              <organization/>
            </author>
            <author initials="M." surname="Naor">
              <organization/>
            </author>
            <author initials="L." surname="Reyzin">
              <organization/>
            </author>
            <author initials="S." surname="Goldberg">
              <organization/>
            </author>
            <date year="2017" month="February"/>
          </front>
          <seriesInfo name="in" value="ePrint Cryptology Archive 2017/099"/>
        </reference>
        <reference anchor="X25519" target="https://cr.yp.to/ecdh.html#validate">
          <front>
            <title>How do I validate Curve25519 public keys?</title>
            <author initials="D.J." surname="Bernstein">
              <organization/>
            </author>
            <date year="2006"/>
          </front>
        </reference>

      </references>
    </references>
    <section numbered="true" toc="default">
      <name>Test Vectors for the ECVRFs</name>
      <t>The test vectors in this section were generated using the reference implementation at <eref target="https://github.com/reyzin/ecvrf"/>.</t>
      <section numbered="true" toc="default">
        <name>ECVRF-P256-SHA256-TAI</name>
        <t>The example secret keys and messages in Examples 1 and 2 are taken from Appendix A.2.5 of <xref target="RFC6979" format="default"/>.</t>
        <t>Example 1:</t>
        <ul empty="true" spacing="compact">
          <li>SK = x = c9afa9d845ba75166b5c215767b1d6934e50c3db36e89b127b8a622b120f6721</li>
          <li>PK = 0360fed4ba255a9d31c961eb74c6356d68c049b8923b61fa6ce669622e60f29fb6</li>
          <li>alpha = 73616d706c65 (ASCII "sample")</li>
          <li>try_and_increment succeeded on ctr = 1</li>
          <li>H = 0272a877532e9ac193aff4401234266f59900a4a9e3fc3cfc6a4b7e467a15d06d4</li>
          <li>k = 0d90591273453d2dc67312d39914e3a93e194ab47a58cd598886897076986f77</li>
          <li>U = k*B = 02bb6a034f67643c6183c10f8b41dc4babf88bff154b674e377d90bde009c21672</li>
          <li>V = k*H = 02893ebee7af9a0faa6da810da8a91f9d50e1dc071240c9706726820ff919e8394</li>
          <li>pi = 035b5c726e8c0e2c488a107c600578ee75cb702343c153cb1eb8dec77f4b5071b4a53f0a46f018bc2c56e58d383f2305e0975972c26feea0eb122fe7893c15af376b33edf7de17c6ea056d4d82de6bc02f</li>
          <li>beta = a3ad7b0ef73d8fc6655053ea22f9bede8c743f08bbed3d38821f0e16474b505e</li>
        </ul>
        
        <t>Example 2:</t>
        <ul empty="true" spacing="compact">
            <li>SK = x = c9afa9d845ba75166b5c215767b1d6934e50c3db36e89b127b8a622b120f6721</li>
            <li>PK = 0360fed4ba255a9d31c961eb74c6356d68c049b8923b61fa6ce669622e60f29fb6</li>
            <li>alpha = 74657374 (ASCII "test")</li>
            <li>try_and_increment succeeded on ctr = 3</li>
            <li>H = 02173119b4fff5e6f8afed4868a29fe8920f1b54c2cf89cc7b301d0d473de6b974</li>
            <li>k = 5852353a868bdce26938cde1826723e58bf8cb06dd2fed475213ea6f3b12e961</li>
            <li>U = k*B = 022779a2cafcb65414c4a04a4b4d2adf4c50395f57995e89e6de823250d91bc48e</li>
            <li>V = k*H = 033b4a14731672e82339f03b45ff6b5b13dee7ada38c9bf1d6f8f61e2ce5921119</li>
            <li>pi = 034dac60aba508ba0c01aa9be80377ebd7562c4a52d74722e0abae7dc3080ddb56c19e067b15a8a8174905b13617804534214f935b94c2287f797e393eb0816969d864f37625b443f30f1a5a33f2b3c854</li>
            <li>beta = a284f94ceec2ff4b3794629da7cbafa49121972671b466cab4ce170aa365f26d</li>
        </ul>
        
        <t>The example secret key in Example 3 is taken from Appendix L.4.2 of <xref target="ANSI.X9-62-2005" format="default"/>.</t>
        
        <t>Example 3:</t>
        <ul empty="true" spacing="compact">
            <li>SK = x = 2ca1411a41b17b24cc8c3b089cfd033f1920202a6c0de8abb97df1498d50d2c8</li>
            <li>PK = 03596375e6ce57e0f20294fc46bdfcfd19a39f8161b58695b3ec5b3d16427c274d</li>
            <li>alpha = 4578616d706c65207573696e67204543445341206b65792066726f6d20417070656e646978204c2e342e32206f6620414e53492e58392d36322d32303035 (ASCII "Example using ECDSA key from Appendix L.4.2 of ANSI.X9-62-2005")</li>
            <li>try_and_increment succeeded on ctr = 1</li>
            <li>H = 0258055c26c4b01d01c00fb57567955f7d39cd6f6e85fd37c58f696cc6b7aa761d</li>
            <li>k = 5689e2e08e1110b4dda293ac21667eac6db5de4a46a519c73d533f69be2f4da3</li>
            <li>U = k*B = 020f465cd0ec74d2e23af0abde4c07e866ae4e5138bded5dd1196b8843f380db84</li>
            <li>V = k*H = 036cb6f811428fc4904370b86c488f60c280fa5b496d2f34ff8772f60ed24b2d1d</li>
            <li>pi = 03d03398bf53aa23831d7d1b2937e005fb0062cbefa06796579f2a1fc7e7b8c667d091c00b0f5c3619d10ecea44363b5a599cadc5b2957e223fec62e81f7b4825fc799a771a3d7334b9186bdbee87316b1</li>
            <li>beta = 90871e06da5caa39a3c61578ebb844de8635e27ac0b13e829997d0d95dd98c19</li>
        </ul>
      </section>
      
      <section numbered="true" toc="default">
        <name>ECVRF-P256-SHA256-SSWU</name>
        <t>The example secret keys and messages in Examples 4 and 5 are taken from Appendix A.2.5 of <xref target="RFC6979" format="default"/>.</t>
        
        <t>Example 4:</t>
        <ul empty="true" spacing="compact">
            <li>SK = x = c9afa9d845ba75166b5c215767b1d6934e50c3db36e89b127b8a622b120f6721</li>
            <li>PK = 0360fed4ba255a9d31c961eb74c6356d68c049b8923b61fa6ce669622e60f29fb6</li>
            <li>alpha = 73616d706c65 (ASCII "sample")</li>
            <li>In SSWU: uniform_bytes = 5024e98d6067dec313af09ff0cbe78218324a645c2a4b0aae2453f6fe91aa3bd9471f7b4a5fbf128e4b53f0c59603f7e</li>
            <li>In SSWU: u = df565615a2372e8b31b8771f7503bafc144e48b05688b97958cc27ce29a8d810</li>
            <li>In SSWU: x1 = e7e39eb8a4c982426fcff629e55a3e13516cfeb62c02c369b1e750316f5e94eb</li>
            <li>In SSWU: gx1 is a nonsquare</li>
            <li>H = 02b31973e872d4a097e2cfae9f37af9f9d73428fde74ac537dda93b5f18dbc5842</li>
            <li>k = e92820035a0a8afe132826c6312662b6ea733fc1a0d33737945016de54d02dd8</li>
            <li>U = k*B = 031490f49d0355ffcdf66e40df788bee93861917ee713acff79be40d20cc91a30a</li>
            <li>V = k*H = 03701df0228138fa3d16612c0d720389326b3265151bc7ac696ea4d0591cd053e3</li>
            <li>pi = 0331d984ca8fece9cbb9a144c0d53df3c4c7a33080c1e02ddb1a96a365394c7888782fffde7b842c38c20c08de6ec6c2e7027a97000f2c9fa4425d5c03e639fb48fde58114d755985498d7eb234cf4aed9</li>
            <li>beta = 21e66dc9747430f17ed9efeda054cf4a264b097b9e8956a1787526ed00dc664b</li>
        </ul>
        
        <t>Example 5:</t>
        <ul empty="true" spacing="compact">
            <li>SK = x = c9afa9d845ba75166b5c215767b1d6934e50c3db36e89b127b8a622b120f6721</li>
            <li>PK = 0360fed4ba255a9d31c961eb74c6356d68c049b8923b61fa6ce669622e60f29fb6</li>
            <li>alpha = 74657374 (ASCII "test")</li>
            <li>In SSWU: uniform_bytes = 910cc66d84a57985a1d15843dad83fd9138a109afb243b7fa5d64d766ec9ca3894fdcf46ebeb21a3972eb452a4232fd3</li>
            <li>In SSWU: u = d8b0107f7e7aa36390240d834852f8703a6dc407019d6196bda5861b8fc00181</li>
            <li>In SSWU: x1 = ccc747fa7318b9486ce4044adbbecaa084c27be6eda88eb7b7f3d688fd0968c7</li>
            <li>In SSWU: gx1 is a square</li>
            <li>H = 03ccc747fa7318b9486ce4044adbbecaa084c27be6eda88eb7b7f3d688fd0968c7</li>
            <li>k = febc3451ea7639fde2cf41ffd03f463124ecb3b5a79913db1ed069147c8a7dea</li>
            <li>U = k*B = 031200f9900e96f811d1247d353573f47e0d9da601fc992566234fc1a5b37749ae</li>
            <li>V = k*H = 02d3715dcfee136c7ae50e95ffca76f4ca6c29ddfb92a39c31a0d48e75c6605cd1</li>
            <li>pi = 03f814c0455d32dbc75ad3aea08c7e2db31748e12802db23640203aebf1fa8db2743aad348a3006dc1caad7da28687320740bf7dd78fe13c298867321ce3b36b79ec3093b7083ac5e4daf3465f9f43c627</li>
            <li>beta = 8e7185d2b420e4f4681f44ce313a26d05613323837da09a69f00491a83ad25dd</li>
        </ul>
        
        <t>The example secret key in Example 6 is taken from Appendix L.4.2 of <xref target="ANSI.X9-62-2005" format="default"/>.</t>
        <t>Example 6:</t>
        <ul empty="true" spacing="compact">
            <li>SK = x = 2ca1411a41b17b24cc8c3b089cfd033f1920202a6c0de8abb97df1498d50d2c8</li>
            <li>PK = 03596375e6ce57e0f20294fc46bdfcfd19a39f8161b58695b3ec5b3d16427c274d</li>
            <li>alpha = 4578616d706c65207573696e67204543445341206b65792066726f6d20417070656e646978204c2e342e32206f6620414e53492e58392d36322d32303035 (ASCII "Example using ECDSA key from Appendix L.4.2 of ANSI.X9-62-2005")</li>
            <li>In SSWU: uniform_bytes = 9b81d55a242d3e8438d3bcfb1bee985a87fd144802c9268cf9adeee160e6e9ff765569797a0f701cb4316018de2e7dd4</li>
            <li>In SSWU: u = e43c98c2ae06d13839fedb0303e5ee815896beda39be83fb11325b97976efdce</li>
            <li>In SSWU: x1 = be9e195a50f175d3563aed8dc2d9f513a5536c1e9aee1757d86c08d32d582a86</li>
            <li>In SSWU: gx1 is a nonsquare</li>
            <li>H = 022dd5150e5a2a24c66feab2f68532be1486e28e07f1b9a055cf38ccc16f6595ff</li>
            <li>k = 8e29221f33564f3f66f858ba2b0c14766e1057adbd422c3e7d0d99d5e142b613</li>
            <li>U = k*B = 03a8823ff9fd16bf879261c740b9c7792b77fee0830f21314117e441784667958d</li>
            <li>V = k*H = 02d48fbb45921c755b73b25be2f23379e3ce69294f6cee9279815f57f4b422659d</li>
            <li>pi = 039f8d9cdc162c89be2871cbcb1435144739431db7fab437ab7bc4e2651a9e99d5488405a11a6c7fc8defddd9e1573a563b7333aab4effe73ae9803274174c659269fd39b53e133dcd9e0d24f01288de9a</li>
            <li>beta = 4fbadf33b42a5f42f23a6f89952d2e634a6e3810f15878b46ef1bb85a04fe95a</li>
        </ul>
      </section>
    
    <section numbered="true" toc="default">
        <name>ECVRF-EDWARDS25519-SHA512-TAI</name>

        <t>The example secret keys and messages in Examples 7, 8, and 9 are taken from Section 7.1 of <xref target="RFC8032" format="default"/>.</t>

        <t>Example 7:</t>
        <ul empty="true" spacing="compact">
            <li>SK = 9d61b19deffd5a60ba844af492ec2cc44449c5697b326919703bac031cae7f60</li>
            <li>PK = d75a980182b10ab7d54bfed3c964073a0ee172f3daa62325af021a68f707511a</li>
            <li>alpha =  (the empty string)</li>
            <li>x = 307c83864f2833cb427a2ef1c00a013cfdff2768d980c0a3a520f006904de94f</li>
            <li>try_and_increment succeeded on ctr = 0</li>
            <li>H = 91bbed02a99461df1ad4c6564a5f5d829d0b90cfc7903e7a5797bd658abf3318</li>
            <li>k_string = 7100f3d9eadb6dc4743b029736ff283f5be494128df128df2817106f345b8594b6d6da2d6fb0b4c0257eb337675d96eab49cf39e66cc2c9547c2bf8b2a6afae4</li>
            <li>k = 8a49edbd1492a8ee09766befe50a7d563051bf3406cbffc20a88def030730f0f</li>
            <li>U = k*B = aef27c725be964c6a9bf4c45ca8e35df258c1878b838f37d9975523f09034071</li>
            <li>V = k*H = 5016572f71466c646c119443455d6cb9b952f07d060ec8286d678615d55f954f</li>
            <li>pi = 8657106690b5526245a92b003bb079ccd1a92130477671f6fc01ad16f26f723f26f8a57ccaed74ee1b190bed1f479d9727d2d0f9b005a6e456a35d4fb0daab1268a1b0db10836d9826a528ca76567805</li>
            <li>beta = 90cf1df3b703cce59e2a35b925d411164068269d7b2d29f3301c03dd757876ff66b71dda49d2de59d03450451af026798e8f81cd2e333de5cdf4f3e140fdd8ae</li>
        </ul>

        <t>Example 8:</t>
        <ul empty="true" spacing="compact">
            <li>SK = 4ccd089b28ff96da9db6c346ec114e0f5b8a319f35aba624da8cf6ed4fb8a6fb</li>
            <li>PK = 3d4017c3e843895a92b70aa74d1b7ebc9c982ccf2ec4968cc0cd55f12af4660c</li>
            <li>alpha = 72 (1 byte)</li>
            <li>x = 68bd9ed75882d52815a97585caf4790a7f6c6b3b7f821c5e259a24b02e502e51</li>
            <li>try_and_increment succeeded on ctr = 1</li>
            <li>H = 5b659fc3d4e9263fd9a4ed1d022d75eaacc20df5e09f9ea937502396598dc551</li>
            <li>k_string = 42589bbf0c485c3c91c1621bb4bfe04aed7be76ee48f9b00793b2342acb9c167cab856f9f9d4febc311330c20b0a8afd3743d05433e8be8d32522ecdc16cc5ce</li>
            <li>k = d8c3a66921444cb3427d5d989f9b315aa8ca3375e9ec4d52207711a1fdb44107</li>
            <li>U = k*B = 1dcb0a4821a2c48bf53548228b7f170962988f6d12f5439f31987ef41f034ab3</li>
            <li>V = k*H = fd03c0bf498c752161bae4719105a074630a2aa5f200ff7b3995f7bfb1513423</li>
            <li>pi = f3141cd382dc42909d19ec5110469e4feae18300e94f304590abdced48aed5933bf0864a62558b3ed7f2fea45c92a465301b3bbf5e3e54ddf2d935be3b67926da3ef39226bbc355bdc9850112c8f4b02</li>
            <li>beta = eb4440665d3891d668e7e0fcaf587f1b4bd7fbfe99d0eb2211ccec90496310eb5e33821bc613efb94db5e5b54c70a848a0bef4553a41befc57663b56373a5031</li>
        </ul>

        <t>Example 9:</t>
        <ul empty="true" spacing="compact">
            <li>SK = c5aa8df43f9f837bedb7442f31dcb7b166d38535076f094b85ce3a2e0b4458f7</li>
            <li>PK = fc51cd8e6218a1a38da47ed00230f0580816ed13ba3303ac5deb911548908025</li>
            <li>alpha = af82 (2 bytes)</li>
            <li>x = 909a8b755ed902849023a55b15c23d11ba4d7f4ec5c2f51b1325a181991ea95c</li>
            <li>try_and_increment succeeded on ctr = 0</li>
            <li>H = bf4339376f5542811de615e3313d2b36f6f53c0acfebb482159711201192576a</li>
            <li>k_string = 38b868c335ccda94a088428cbf3ec8bc7955bfaffe1f3bd2aa2c59fc31a0febc59d0e1af3715773ce11b3bbdd7aba8e3505d4b9de6f7e4a96e67e0d6bb6d6c3a</li>
            <li>k = 5ffdbc72135d936014e8ab708585fda379405542b07e3bd2c0bd48437fbac60a</li>
            <li>U = k*B = 2bae73e15a64042fcebf062abe7e432b2eca6744f3e8265bc38e009cd577ecd5</li>
            <li>V = k*H = 88cba1cb0d4f9b649d9a86026b69de076724a93a65c349c988954f0961c5d506</li>
            <li>pi = 9bc0f79119cc5604bf02d23b4caede71393cedfbb191434dd016d30177ccbf8096bb474e53895c362d8628ee9f9ea3c0e52c7a5c691b6c18c9979866568add7a2d41b00b05081ed0f58ee5e31b3a970e</li>
            <li>beta = 645427e5d00c62a23fb703732fa5d892940935942101e456ecca7bb217c61c452118fec1219202a0edcf038bb6373241578be7217ba85a2687f7a0310b2df19f</li>
        </ul>
      </section>

      <section numbered="true" toc="default">
        <name>ECVRF-EDWARDS25519-SHA512-ELL2</name>

        <t>The example secret keys and messages in Examples 10, 11, and 12 are taken from Section 7.1 of <xref target="RFC8032" format="default"/>.</t>

        <t>Example 10:</t>
        <ul empty="true" spacing="compact">
            <li>SK = 9d61b19deffd5a60ba844af492ec2cc44449c5697b326919703bac031cae7f60</li>
            <li>PK = d75a980182b10ab7d54bfed3c964073a0ee172f3daa62325af021a68f707511a</li>
            <li>alpha =  (the empty string)</li>
            <li>x = 307c83864f2833cb427a2ef1c00a013cfdff2768d980c0a3a520f006904de94f</li>
            <li>In Elligator2: uniform_bytes = d620782a206d9de584b74e23ae5ee1db5ca5298b3fc527c4867f049dee6dd419b3674967bd614890f621c128d72269ae</li>
            <li>In Elligator2: u = 30f037b9745a57a9a2b8a68da81f397c39d46dee9d047f86c427c53f8b29a55c</li>
            <li>In Elligator2: gx1 = 8cb66318fb2cea01672d6c27a5ab662ae33220961607f69276080a56477b4a08</li>
            <li>In Elligator2: gx1 is a square</li>
            <li>H = b8066ebbb706c72b64390324e4a3276f129569eab100c26b9f05011200c1bad9</li>
            <li>k_string = b5682049fee54fe2d519c9afff73bbfad724e69a82d5051496a42458f817bed7a386f96b1a78e5736756192aeb1818a20efb336a205ffede351cfe88dab8d41c</li>
            <li>k = 55cbb247af9b8372259a97b2cfec656d78868deb33b203d51b9961c364522400</li>
            <li>U = k*B = 762f5c178b68f0cddcc1157918edf45ec334ac8e8286601a3256c3bbf858edd9</li>
            <li>V = k*H = 4652eba1c4612e6fce762977a59420b451e12964adbe4fbecd58a7aeff5860af</li>
            <li>pi = 7d9c633ffeee27349264cf5c667579fc583b4bda63ab71d001f89c10003ab46f14adf9a3cd8b8412d9038531e865c341cafa73589b023d14311c331a9ad15ff2fb37831e00f0acaa6d73bc9997b06501</li>
            <li>beta = 9d574bf9b8302ec0fc1e21c3ec5368269527b87b462ce36dab2d14ccf80c53cccf6758f058c5b1c856b116388152bbe509ee3b9ecfe63d93c3b4346c1fbc6c54</li>
        </ul>

        <t>Example 11:</t>
        <ul empty="true" spacing="compact">
            <li>SK = 4ccd089b28ff96da9db6c346ec114e0f5b8a319f35aba624da8cf6ed4fb8a6fb</li>
            <li>PK = 3d4017c3e843895a92b70aa74d1b7ebc9c982ccf2ec4968cc0cd55f12af4660c</li>
            <li>alpha = 72 (1 byte)</li>
            <li>x = 68bd9ed75882d52815a97585caf4790a7f6c6b3b7f821c5e259a24b02e502e51</li>
            <li>In Elligator2: uniform_bytes = 04ae20a9ad2a2330fb33318e376a2448bd77bb99e81d126f47952b156590444a9225b84128b66a2f15b41294fa2f2f6d</li>
            <li>In Elligator2: u = 3092f033b16d4d5f74a3f7dc7091fe434b449065152b95476f121de899bb773d</li>
            <li>In Elligator2: gx1 = 25d7fe7f82456e7078e99fdb24ef2582b4608357cdba9c39a8d535a3fd98464d</li>
            <li>In Elligator2: gx1 is a nonsquare</li>
            <li>H = 76ac3ccb86158a9104dff819b1ca293426d305fd76b39b13c9356d9b58c08e57</li>
            <li>k_string = 88bf479281fd29a6cbdffd67e2c5ec0024d92f14eaed58f43f22f37c4c37f1d41e65c036fbf01f9fba11d554c07494d0c02e7e5c9d64be88ef78cab7544e444d</li>
            <li>k = 9565956daeedf376cad61b829b2a4d21ba1b52e9b3e2457477a64630a9711003</li>
            <li>U = k*B = 8ec26e77b8cb3114dd2265fe1564a4efb40d109aa3312536d93dfe3d8d80a061</li>
            <li>V = k*H = fe799eb5770b4e3a5a27d22518bb631db183c8316bb552155f442c62a47d1c8b</li>
            <li>pi = 47b327393ff2dd81336f8a2ef10339112401253b3c714eeda879f12c509072ef055b48372bb82efbdce8e10c8cb9a2f9d60e93908f93df1623ad78a86a028d6bc064dbfc75a6a57379ef855dc6733801</li>
            <li>beta = 38561d6b77b71d30eb97a062168ae12b667ce5c28caccdf76bc88e093e4635987cd96814ce55b4689b3dd2947f80e59aac7b7675f8083865b46c89b2ce9cc735</li>
        </ul>

        <t>Example 12:</t>
        <ul empty="true" spacing="compact">
            <li>SK = c5aa8df43f9f837bedb7442f31dcb7b166d38535076f094b85ce3a2e0b4458f7</li>
            <li>PK = fc51cd8e6218a1a38da47ed00230f0580816ed13ba3303ac5deb911548908025</li>
            <li>alpha = af82 (2 bytes)</li>
            <li>x = 909a8b755ed902849023a55b15c23d11ba4d7f4ec5c2f51b1325a181991ea95c</li>
            <li>In Elligator2: uniform_bytes = be0aed556e36cdfddf8f1eeddbb7356a24fad64cf95a922a098038f215588b216beabbfe6acf20256188e883292b7a3a</li>
            <li>In Elligator2: u = f6675dc6d17fc790d4b3f1c6acf689a13d8b5815f23880092a925af94cd6fa24</li>
            <li>In Elligator2: gx1 = a63d48e3247c903e22fdfb88fd9295e396712a5fe576af335dbe16f99f0af26c</li>
            <li>In Elligator2: gx1 is a square</li>
            <li>H = 13d2a8b5ca32db7e98094a61f656a08c6c964344e058879a386a947a4e189ed1</li>
            <li>k_string = a7ddd74a3a7d165d511b02fa268710ddbb3b939282d276fa2efcfa5aaf79cf576087299ca9234aacd7cd674d912deba00f4e291733ef189a51e36c861b3d683b</li>
            <li>k = 1fda4077f737098b3f361c33a36cccafd7e9e9b720e1f84011254e25f37eed02</li>
            <li>U = k*B = a012f35433df219a88ab0f9481f4e0065d00422c3285f3d34a8b0202f20bac60</li>
            <li>V = k*H = fb613986d171b3e98319c7ca4dc44c5dd8314a6e5616c1a4f16ce72bd7a0c25a</li>
            <li>pi = 926e895d308f5e328e7aa159c06eddbe56d06846abf5d98c2512235eaa57fdce35b46edfc655bc828d44ad09d1150f31374e7ef73027e14760d42e77341fe05467bb286cc2c9d7fde29120a0b2320d04</li>
            <li>beta = 121b7f9b9aaaa29099fc04a94ba52784d44eac976dd1a3cca458733be5cd090a7b5fbd148444f17f8daf1fb55cb04b1ae85a626e30a54b4b0f8abf4a43314a58</li>
        </ul>
      </section>
    </section>
    <!--
    <section title="Open Issues">
        <t>
            Note to RFC Editor: please remove this appendix before publication as an RFC.
        </t>

        <t>
            <list style="numbers">
                <t>Open issue.</t>
            </list>
        </t>
    </section>
    -->
  </back>
</rfc>
