pub struct Input<S: Suite>(pub AffinePoint<S>);Expand description
VRF input point generic over the cipher suite.
Elliptic curve point representing the VRF input.
Tuple Fields§
§0: AffinePoint<S>Implementations§
Source§impl<S: Suite> Input<S>
impl<S: Suite> Input<S>
Sourcepub fn new(data: &[u8]) -> Option<Self>
pub fn new(data: &[u8]) -> Option<Self>
Construct from Suite::data_to_point.
Maps arbitrary data to a curve point via hash-to-curve.
Source§impl<S: Suite> Input<S>
impl<S: Suite> Input<S>
Sourcepub fn from_affine(value: AffinePoint<S>) -> Result<Self, Error>
pub fn from_affine(value: AffinePoint<S>) -> Result<Self, Error>
Construct from an affine point with validation.
Returns Error::InvalidData if the point is not in the prime-order
subgroup or is the group identity.
Note: this only validates subgroup membership, not that the point was produced by hash-to-curve. The caller is still responsible for ensuring the point is not in a known discrete-log relation with the suite generator (required for Thin-VRF soundness).
Sourcepub fn from_affine_unchecked(value: AffinePoint<S>) -> Self
pub fn from_affine_unchecked(value: AffinePoint<S>) -> Self
Construct from an affine point without validation.
§Safety
The caller must ensure that value is in the prime-order subgroup, is
not the group identity, and was produced by a hash-to-curve procedure
(or is otherwise not in a known discrete-log relation with the suite
generator). The latter is required for the soundness of schemes like
Thin-VRF where the input and generator are delinearized into a single
check.
Trait Implementations§
Source§impl<S: Suite> CanonicalDeserialize for Input<S>
impl<S: Suite> CanonicalDeserialize for Input<S>
Source§fn deserialize_with_mode<R: Read>(
reader: R,
compress: Compress,
validate: Validate,
) -> Result<Self, SerializationError>
fn deserialize_with_mode<R: Read>( reader: R, compress: Compress, validate: Validate, ) -> Result<Self, SerializationError>
Source§fn deserialize_compressed<R>(reader: R) -> Result<Self, SerializationError>where
R: Read,
fn deserialize_compressed<R>(reader: R) -> Result<Self, SerializationError>where
R: Read,
Self from reader using the compressed form if applicable.
Performs validation if applicable.Source§fn deserialize_compressed_unchecked<R>(
reader: R,
) -> Result<Self, SerializationError>where
R: Read,
fn deserialize_compressed_unchecked<R>(
reader: R,
) -> Result<Self, SerializationError>where
R: Read,
Self from reader using the compressed form if applicable, without validating the
deserialized value. Read moreSource§fn deserialize_uncompressed<R>(reader: R) -> Result<Self, SerializationError>where
R: Read,
fn deserialize_uncompressed<R>(reader: R) -> Result<Self, SerializationError>where
R: Read,
Self from reader using the uncompressed form. Performs validation if applicable.Source§fn deserialize_uncompressed_unchecked<R>(
reader: R,
) -> Result<Self, SerializationError>where
R: Read,
fn deserialize_uncompressed_unchecked<R>(
reader: R,
) -> Result<Self, SerializationError>where
R: Read,
Self from reader using the uncompressed form, without validating the deserialized
value. Read moreSource§impl<S: Suite> CanonicalSerialize for Input<S>
impl<S: Suite> CanonicalSerialize for Input<S>
Source§fn serialize_with_mode<W: Write>(
&self,
writer: W,
compress: Compress,
) -> Result<(), SerializationError>
fn serialize_with_mode<W: Write>( &self, writer: W, compress: Compress, ) -> Result<(), SerializationError>
Source§fn serialized_size(&self, compress: Compress) -> usize
fn serialized_size(&self, compress: Compress) -> usize
self with the given compression mode.Source§fn serialize_compressed<W>(&self, writer: W) -> Result<(), SerializationError>where
W: Write,
fn serialize_compressed<W>(&self, writer: W) -> Result<(), SerializationError>where
W: Write,
self into writer using the compressed form if applicable.Source§fn compressed_size(&self) -> usize
fn compressed_size(&self) -> usize
self.Source§fn serialize_uncompressed<W>(&self, writer: W) -> Result<(), SerializationError>where
W: Write,
fn serialize_uncompressed<W>(&self, writer: W) -> Result<(), SerializationError>where
W: Write,
self into writer using the uncompressed form.Source§fn uncompressed_size(&self) -> usize
fn uncompressed_size(&self) -> usize
self.impl<S: Copy + Suite> Copy for Input<S>
impl<S: Eq + Suite> Eq for Input<S>
impl<S: PartialEq + Suite> StructuralPartialEq for Input<S>
Source§impl<S: Suite> Valid for Input<S>
impl<S: Suite> Valid for Input<S>
Source§fn check(&self) -> Result<(), SerializationError>
fn check(&self) -> Result<(), SerializationError>
self is valid. If self is valid, returns Ok(()). Otherwise, returns
an error describing the failure.
This method is called by deserialize_with_mode if validate is Validate::Yes.Source§const TRIVIAL_CHECK: bool = false
const TRIVIAL_CHECK: bool = false
check method is trivial (i.e. always returns Ok(())). If this is true,
the batch_check method will skip all checks and return Ok(()).
This should be set to true for types where check is trivial, e.g.
integers, field elements, etc.
This is false by default.
This is primarily an optimization to skip unnecessary checks in batch_check.Source§fn batch_check<'a>(
batch: impl Iterator<Item = &'a Self> + Send,
) -> Result<(), SerializationError>where
Self: 'a,
fn batch_check<'a>(
batch: impl Iterator<Item = &'a Self> + Send,
) -> Result<(), SerializationError>where
Self: 'a,
batch are valid. If all items are valid, returns Ok(()).
Otherwise, returns an error describing the first failure.Auto Trait Implementations§
impl<S> Freeze for Input<S>
impl<S> RefUnwindSafe for Input<S>
impl<S> Send for Input<S>
impl<S> Sync for Input<S>
impl<S> Unpin for Input<S>
impl<S> UnsafeUnpin for Input<S>
impl<S> UnwindSafe for Input<S>
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> CanonicalSerializeHashExt for Twhere
T: CanonicalSerialize,
impl<T> CanonicalSerializeHashExt for Twhere
T: CanonicalSerialize,
fn hash<H>(&self) -> GenericArray<u8, <H as OutputSizeUser>::OutputSize>where
H: Digest,
fn hash_uncompressed<H>(
&self,
) -> GenericArray<u8, <H as OutputSizeUser>::OutputSize>where
H: Digest,
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more