Trait GroupEncoding
pub trait GroupEncoding: Sized {
type Repr: Copy + Default + Send + Sync + 'static + AsRef<[u8]> + AsMut<[u8]>;
// Required methods
fn from_bytes(bytes: &Self::Repr) -> CtOption<Self>;
fn from_bytes_unchecked(bytes: &Self::Repr) -> CtOption<Self>;
fn to_bytes(&self) -> Self::Repr;
}Required Associated Types§
type Repr: Copy + Default + Send + Sync + 'static + AsRef<[u8]> + AsMut<[u8]>
type Repr: Copy + Default + Send + Sync + 'static + AsRef<[u8]> + AsMut<[u8]>
The encoding of group elements.
The Default implementation is not required to return a valid point encoding. The
bound is present to enable encodings to be constructed generically:
let mut encoding = <G as GroupEncoding>::Repr::default();
encoding.as_mut().copy_from_slice(buf);It is recommended that the default should be the all-zeroes encoding.
Required Methods§
fn from_bytes(bytes: &Self::Repr) -> CtOption<Self>
fn from_bytes(bytes: &Self::Repr) -> CtOption<Self>
Attempts to deserialize a group element from its encoding.
fn from_bytes_unchecked(bytes: &Self::Repr) -> CtOption<Self>
fn from_bytes_unchecked(bytes: &Self::Repr) -> CtOption<Self>
Attempts to deserialize a group element, not checking if the element is valid.
This is dangerous to call unless you trust the bytes you are reading; otherwise,
API invariants may be broken. Please consider using
GroupEncoding::from_bytes instead.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
§impl GroupEncoding for AffinePoint
impl GroupEncoding for AffinePoint
type Repr = Array<u8, UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B1>>
fn from_bytes( bytes: &<AffinePoint as GroupEncoding>::Repr, ) -> CtOption<AffinePoint>
fn from_bytes_unchecked( bytes: &<AffinePoint as GroupEncoding>::Repr, ) -> CtOption<AffinePoint>
fn to_bytes(&self) -> <AffinePoint as GroupEncoding>::Repr
§impl GroupEncoding for AffinePoint
impl GroupEncoding for AffinePoint
type Repr = GroupRepr
fn from_bytes( bytes: &<AffinePoint as GroupEncoding>::Repr, ) -> CtOption<AffinePoint>
fn from_bytes_unchecked( bytes: &<AffinePoint as GroupEncoding>::Repr, ) -> CtOption<AffinePoint>
fn to_bytes(&self) -> <AffinePoint as GroupEncoding>::Repr
§impl GroupEncoding for ProjectivePoint
impl GroupEncoding for ProjectivePoint
type Repr = Array<u8, UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B1>>
fn from_bytes( bytes: &<ProjectivePoint as GroupEncoding>::Repr, ) -> CtOption<ProjectivePoint>
fn from_bytes_unchecked( bytes: &<ProjectivePoint as GroupEncoding>::Repr, ) -> CtOption<ProjectivePoint>
fn to_bytes(&self) -> <ProjectivePoint as GroupEncoding>::Repr
§impl GroupEncoding for ProjectivePoint
impl GroupEncoding for ProjectivePoint
type Repr = GroupRepr
fn from_bytes( bytes: &<ProjectivePoint as GroupEncoding>::Repr, ) -> CtOption<ProjectivePoint>
fn from_bytes_unchecked( bytes: &<ProjectivePoint as GroupEncoding>::Repr, ) -> CtOption<ProjectivePoint>
fn to_bytes(&self) -> <ProjectivePoint as GroupEncoding>::Repr
§impl<C> GroupEncoding for AffinePoint<C>where
C: PrimeCurveParams,
impl<C> GroupEncoding for AffinePoint<C>where
C: PrimeCurveParams,
§fn from_bytes(
bytes: &<AffinePoint<C> as GroupEncoding>::Repr,
) -> CtOption<AffinePoint<C>>
fn from_bytes( bytes: &<AffinePoint<C> as GroupEncoding>::Repr, ) -> CtOption<AffinePoint<C>>
NOTE: not constant-time with respect to identity point