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
sourceimpl 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
sourceimpl Ord for VRFInOut
impl Ord for VRFInOut
sourceimpl PartialOrd<VRFInOut> for VRFInOut
impl PartialOrd<VRFInOut> for VRFInOut
sourcefn partial_cmp(&self, other: &VRFInOut) -> Option<Ordering>
fn partial_cmp(&self, other: &VRFInOut) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl Eq for VRFInOut
impl StructuralEq for VRFInOut
impl StructuralPartialEq for VRFInOut
Auto Trait Implementations
impl RefUnwindSafe for VRFInOut
impl Send for VRFInOut
impl Sync for VRFInOut
impl Unpin for VRFInOut
impl UnwindSafe for VRFInOut
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more