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 appendix 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 for VRFInOut
impl PartialEq for VRFInOut
source§impl PartialOrd for VRFInOut
impl PartialOrd 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 moreimpl Eq for VRFInOut
impl StructuralPartialEq for VRFInOut
Auto Trait Implementations§
impl Freeze for VRFInOut
impl RefUnwindSafe for VRFInOut
impl Send for VRFInOut
impl Sync for VRFInOut
impl Unpin for VRFInOut
impl UnwindSafe for VRFInOut
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)