Struct schnorrkel::vrf::VRFInOut
source · pub struct VRFInOut {
pub input: RistrettoBoth,
pub output: RistrettoBoth,
}
Expand description
VRF input and output paired together, possibly unverified.
Internally, we keep both RistrettoPoint
and CompressedRistretto
forms using RistrettoBoth
.
Fields§
§input: RistrettoBoth
VRF input point
output: RistrettoBoth
VRF output point
Implementations§
source§impl VRFInOut
impl VRFInOut
sourcepub fn as_output_bytes(&self) -> &[u8; 32]
pub fn as_output_bytes(&self) -> &[u8; 32]
VRF output point bytes for serialization.
sourcepub fn commit<T: SigningTranscript>(&self, t: &mut T)
pub fn commit<T: SigningTranscript>(&self, t: &mut T)
Commit VRF input and output to a transcript.
We commit both the input and output to provide the 2Hash-DH construction from Theorem 2 on page 32 in appendix C of “Ouroboros Praos: An adaptively-secure, semi-synchronous proof-of-stake blockchain” by Bernardo David, Peter Gazi, Aggelos Kiayias, and Alexander Russell.
We use this construction both for the VRF usage methods
VRFInOut::make_*
as well as for signer side batching.
sourcepub fn make_bytes<B: Default + AsMut<[u8]>>(&self, context: &[u8]) -> B
pub fn make_bytes<B: Default + AsMut<[u8]>>(&self, context: &[u8]) -> B
Raw bytes output from the VRF.
If you are not the signer then you must verify the VRF before calling this method.
If called with distinct contexts then outputs should be independent.
We incorporate both the input and output to provide the 2Hash-DH construction from Theorem 2 on page 32 in appendex C of “Ouroboros Praos: An adaptively-secure, semi-synchronous proof-of-stake blockchain” by Bernardo David, Peter Gazi, Aggelos Kiayias, and Alexander Russell.
sourcepub fn make_rng<R: SeedableRng>(&self, context: &[u8]) -> R
pub fn make_rng<R: SeedableRng>(&self, context: &[u8]) -> R
VRF output converted into any SeedableRng
.
If you are not the signer then you must verify the VRF before calling this method.
We expect most users would prefer the less generic VRFInOut::make_chacharng
method.
sourcepub fn make_merlin_rng(&self, context: &[u8]) -> TranscriptRng
pub fn make_merlin_rng(&self, context: &[u8]) -> TranscriptRng
VRF output converted into Merlin’s Keccek based Rng
.
If you are not the signer then you must verify the VRF before calling this method.
We think this might be marginally slower than ChaChaRng
when considerable output is required, but it should reduce
the final linked binary size slightly, and improves domain
separation.
Trait Implementations§
source§impl Ord for VRFInOut
impl Ord for VRFInOut
source§impl PartialEq<VRFInOut> for VRFInOut
impl PartialEq<VRFInOut> for VRFInOut
source§impl PartialOrd<VRFInOut> for VRFInOut
impl PartialOrd<VRFInOut> for VRFInOut
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more