Trait group::GroupEncoding [−][src]
pub trait GroupEncoding: Sized { type Repr: Default + AsRef<[u8]> + AsMut<[u8]>; fn from_bytes(bytes: &Self::Repr) -> CtOption<Self>; fn from_bytes_unchecked(bytes: &Self::Repr) -> CtOption<Self>; fn to_bytes(&self) -> Self::Repr; }
Associated Types
type Repr: Default + AsRef<[u8]> + AsMut<[u8]>
[src]
type Repr: Default + AsRef<[u8]> + AsMut<[u8]>
[src]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>
[src]
fn from_bytes(bytes: &Self::Repr) -> CtOption<Self>
[src]Attempts to deserialize a group element from its encoding.
fn from_bytes_unchecked(bytes: &Self::Repr) -> CtOption<Self>
[src]
fn from_bytes_unchecked(bytes: &Self::Repr) -> CtOption<Self>
[src]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.