vrfHash method
Computes a VRF (Verifiable Random Function) hash using a transcript.
This method computes a VRF hash by appending a Schnorrkel public key to the provided transcript, extracting 64 bytes, and converting it into a RistrettoPoint point.
Parameters:
script
: A transcript containing context-specific information for the VRF hash computation.
Returns: A RistrettoPoint point representing the VRF hash.
Example Usage:
MerlinTranscript script = ...;
SchnorrkelPublicKey publicKey = ...;
RistrettoPoint vrfHashPoint = publicKey.vrfHash(script);
The vrfHash
method is used to compute a VRF hash by appending the public key to a transcript
and extracting the resulting hash as a RistrettoPoint point.
Implementation
RistrettoPoint vrfHash(MerlinTranscript script) {
script.additionalData("vrf-nm-pk".codeUnits, toBytes());
final hashPoint =
RistrettoPoint.fromUniform(script.toBytes("VRFHash".codeUnits, 64));
return hashPoint;
}