pub trait WeierstrassPoint: Sized {
type Coordinate: Field;
const CURVE_B: Self::Coordinate;
const IDENTITY: Self;
Show 15 methods
// Required methods
fn as_le_bytes(&self) -> &[u8] ⓘ;
fn from_xy_unchecked(x: Self::Coordinate, y: Self::Coordinate) -> Self;
fn into_coords(self) -> (Self::Coordinate, Self::Coordinate);
fn x(&self) -> &Self::Coordinate;
fn y(&self) -> &Self::Coordinate;
fn x_mut(&mut self) -> &mut Self::Coordinate;
fn y_mut(&mut self) -> &mut Self::Coordinate;
fn add_ne_nonidentity(&self, p2: &Self) -> Self;
fn add_ne_assign_nonidentity(&mut self, p2: &Self);
fn sub_ne_nonidentity(&self, p2: &Self) -> Self;
fn sub_ne_assign_nonidentity(&mut self, p2: &Self);
fn double_nonidentity(&self) -> Self;
fn double_assign_nonidentity(&mut self);
// Provided methods
fn from_xy(x: Self::Coordinate, y: Self::Coordinate) -> Option<Self>
where for<'a> &'a Self::Coordinate: Mul<&'a Self::Coordinate, Output = Self::Coordinate> { ... }
fn from_xy_nonidentity(
x: Self::Coordinate,
y: Self::Coordinate,
) -> Option<Self>
where for<'a> &'a Self::Coordinate: Mul<&'a Self::Coordinate, Output = Self::Coordinate> { ... }
}
Expand description
Short Weierstrass curve affine point.
Required Associated Constants§
Sourceconst CURVE_B: Self::Coordinate
const CURVE_B: Self::Coordinate
The b
coefficient in the Weierstrass curve equation y^2 = x^3 + a x + b
.
const IDENTITY: Self
Required Associated Types§
type Coordinate: Field
Required Methods§
Sourcefn as_le_bytes(&self) -> &[u8] ⓘ
fn as_le_bytes(&self) -> &[u8] ⓘ
The concatenated x, y
coordinates of the affine point, where
coordinates are in little endian.
Warning: The memory layout of Self
is expected to pack
x
and y
contigously with no unallocated space in between.
Sourcefn from_xy_unchecked(x: Self::Coordinate, y: Self::Coordinate) -> Self
fn from_xy_unchecked(x: Self::Coordinate, y: Self::Coordinate) -> Self
Raw constructor without asserting point is on the curve.
fn into_coords(self) -> (Self::Coordinate, Self::Coordinate)
fn x(&self) -> &Self::Coordinate
fn y(&self) -> &Self::Coordinate
fn x_mut(&mut self) -> &mut Self::Coordinate
fn y_mut(&mut self) -> &mut Self::Coordinate
Sourcefn add_ne_nonidentity(&self, p2: &Self) -> Self
fn add_ne_nonidentity(&self, p2: &Self) -> Self
Hazmat: Assumes self != +- p2 and self != identity and p2 != identity.
Sourcefn add_ne_assign_nonidentity(&mut self, p2: &Self)
fn add_ne_assign_nonidentity(&mut self, p2: &Self)
Hazmat: Assumes self != +- p2 and self != identity and p2 != identity.
Sourcefn sub_ne_nonidentity(&self, p2: &Self) -> Self
fn sub_ne_nonidentity(&self, p2: &Self) -> Self
Hazmat: Assumes self != +- p2 and self != identity and p2 != identity.
Sourcefn sub_ne_assign_nonidentity(&mut self, p2: &Self)
fn sub_ne_assign_nonidentity(&mut self, p2: &Self)
Hazmat: Assumes self != +- p2 and self != identity and p2 != identity.
Sourcefn double_nonidentity(&self) -> Self
fn double_nonidentity(&self) -> Self
Hazmat: Assumes self != identity and 2 * self != identity.
Sourcefn double_assign_nonidentity(&mut self)
fn double_assign_nonidentity(&mut self)
Hazmat: Assumes self != identity and 2 * self != identity.
Provided Methods§
fn from_xy(x: Self::Coordinate, y: Self::Coordinate) -> Option<Self>
fn from_xy_nonidentity(x: Self::Coordinate, y: Self::Coordinate) -> Option<Self>
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.