pub struct Point(/* private fields */);Expand description
A point on the curve, the point at infinity included.
Held in the arithmetic driver’s own representation (projective
coordinates, typically), so a chain of operations converts to
affine coordinates once, when asked to through Self::to_affine.
Comparing two points converts both. Arithmetic is served by the
curve’s arithmetic driver.
Implementations§
Source§impl Point
impl Point
Sourcepub fn from_xy(x: &[u8; 32], y: &[u8; 32]) -> Result<Self, Error>
pub fn from_xy(x: &[u8; 32], y: &[u8; 32]) -> Result<Self, Error>
Build a point from its coordinates, checking that it is on the curve.
Sourcepub fn from_sec1(bytes: &[u8; 65]) -> Result<Self, Error>
pub fn from_sec1(bytes: &[u8; 65]) -> Result<Self, Error>
Parse an uncompressed SEC1 encoding (0x04 || x || y), checking
that the point is on the curve.
Sourcepub fn from_affine(p: &P256Point) -> Result<Self, Error>
pub fn from_affine(p: &P256Point) -> Result<Self, Error>
Import an affine point, checking that it is on the curve.
Sourcepub fn to_affine(&self) -> Option<P256Point>
pub fn to_affine(&self) -> Option<P256Point>
The affine coordinates, or None for the point at infinity.
Sourcepub fn to_sec1(&self) -> Option<[u8; 65]>
pub fn to_sec1(&self) -> Option<[u8; 65]>
The uncompressed SEC1 encoding (0x04 || x || y), or None
for the point at infinity.
Sourcepub fn is_identity(&self) -> bool
pub fn is_identity(&self) -> bool
Whether this is the point at infinity.
Sourcepub fn from_driver(p: P256ArithImplPoint) -> Self
pub fn from_driver(p: P256ArithImplPoint) -> Self
Wrap a point in the driver representation.
Sourcepub fn as_driver(&self) -> &P256ArithImplPoint
pub fn as_driver(&self) -> &P256ArithImplPoint
The driver representation.
Sourcepub fn lincomb(a: &Scalar, p: &Self, b: &Scalar, q: &Self) -> Self
pub fn lincomb(a: &Scalar, p: &Self, b: &Scalar, q: &Self) -> Self
a * p + b * q.
Constant-time in the scalars: safe for secret scalars, as in a
PAKE or a Schnorr-style signature. Cheaper than the equivalent
muls and add when the driver shares the doublings.
Sourcepub fn lincomb_vartime(a: &Scalar, p: &Self, b: &Scalar, q: &Self) -> Self
pub fn lincomb_vartime(a: &Scalar, p: &Self, b: &Scalar, q: &Self) -> Self
a * p + b * q.
May be variable-time: only for public inputs, as in signature
verification. Faster than Self::lincomb.