pub trait PrimeOrderCurve:
Copy
+ Clone
+ Sized
+ Send
+ Sync
+ Debug
+ Eq
+ 'static
+ Neg<Output = Self>
+ Mul<Self::Scalar, Output = Self>
+ Add<Self, Output = Self>
+ Sub<Self, Output = Self>
+ AddAssign<Self>
+ SubAssign<Self>
+ MulAssign<Self::Scalar>
+ Serialize
+ for<'de> Deserialize<'de>
+ Zeroizable {
type Scalar: Field;
type Base: Field;
const UNCOMPRESSED_CURVE_POINT_BYTEWIDTH: usize;
const COMPRESSED_CURVE_POINT_BYTEWIDTH: usize;
const SCALAR_ELEM_BYTEWIDTH: usize;
Show 13 methods
// Required methods
fn zero() -> Self;
fn generator() -> Self;
fn random(rng: impl RngCore) -> Self;
fn double(&self) -> Self;
fn projective_coordinates(&self) -> (Self::Base, Self::Base, Self::Base);
fn affine_coordinates(&self) -> Option<(Self::Base, Self::Base)>;
fn to_bytes_uncompressed(&self) -> Vec<u8> ⓘ;
fn to_bytes_compressed(&self) -> Vec<u8> ⓘ;
fn from_bytes_uncompressed(bytes: &[u8]) -> Self;
fn from_bytes_compressed(bytes: &[u8]) -> Self;
fn from_xy(x: Self::Base, y: Self::Base) -> Self;
fn from_x_and_sign_y(x: Self::Base, y_sign: u8) -> Self;
fn scalar_mult_unsigned_integer<T: Unsigned + Zero + ToBytes>(
&self,
scalar: &T,
) -> Self;
}Expand description
Minimal interface for an elliptic curve of prime order.
Required Associated Constants§
Sourceconst UNCOMPRESSED_CURVE_POINT_BYTEWIDTH: usize
const UNCOMPRESSED_CURVE_POINT_BYTEWIDTH: usize
The byte sizes for the serialized representations.
const COMPRESSED_CURVE_POINT_BYTEWIDTH: usize
const SCALAR_ELEM_BYTEWIDTH: usize
Required Associated Types§
Required Methods§
Sourcefn projective_coordinates(&self) -> (Self::Base, Self::Base, Self::Base)
fn projective_coordinates(&self) -> (Self::Base, Self::Base, Self::Base)
Return the projective coordinates of the point.
Sourcefn affine_coordinates(&self) -> Option<(Self::Base, Self::Base)>
fn affine_coordinates(&self) -> Option<(Self::Base, Self::Base)>
Return the affine coordinates of the point, if it is not at the identity (in which case, return None).
Sourcefn to_bytes_uncompressed(&self) -> Vec<u8> ⓘ
fn to_bytes_uncompressed(&self) -> Vec<u8> ⓘ
Returns an uncompressed byte representation of a curve element.
Sourcefn to_bytes_compressed(&self) -> Vec<u8> ⓘ
fn to_bytes_compressed(&self) -> Vec<u8> ⓘ
Returns a compressed byte representation of a curve element. TODO!(ryancao): Should we also have a self type representing the bitwidth?
Sourcefn from_bytes_uncompressed(bytes: &[u8]) -> Self
fn from_bytes_uncompressed(bytes: &[u8]) -> Self
Returns the unique curve element represented by the uncompressed bytestring.
Sourcefn from_bytes_compressed(bytes: &[u8]) -> Self
fn from_bytes_compressed(bytes: &[u8]) -> Self
Returns the unique curve element represented by the compressed bytestring.
Sourcefn from_xy(x: Self::Base, y: Self::Base) -> Self
fn from_xy(x: Self::Base, y: Self::Base) -> Self
Returns the group element from x and y coordinates.
Sourcefn from_x_and_sign_y(x: Self::Base, y_sign: u8) -> Self
fn from_x_and_sign_y(x: Self::Base, y_sign: u8) -> Self
Returns the group element from x coordinate + parity of y.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.