pub struct Point { /* private fields */ }Expand description
A point on the sect283k1 elliptic curve
Implementations§
Source§impl Point
impl Point
Sourcepub fn new_uncompressed(x: &[u8; 36], y: &[u8; 36]) -> Result<Self>
pub fn new_uncompressed(x: &[u8; 36], y: &[u8; 36]) -> Result<Self>
Create a new point from uncompressed coordinates.
Returns an error if the coordinates don’t satisfy the curve equation y² + xy = x³ + 1.
Sourcepub fn is_identity(&self) -> bool
pub fn is_identity(&self) -> bool
Check if this point is the identity element.
Sourcepub fn x_coordinate_bytes(&self) -> [u8; 36]
pub fn x_coordinate_bytes(&self) -> [u8; 36]
Get the x-coordinate of this point as bytes.
Sourcepub fn y_coordinate_bytes(&self) -> [u8; 36]
pub fn y_coordinate_bytes(&self) -> [u8; 36]
Get the y-coordinate of this point as bytes.
Sourcepub fn serialize_compressed(&self) -> [u8; 37]
pub fn serialize_compressed(&self) -> [u8; 37]
Serialize this point in compressed format.
The compressed format uses the trace to disambiguate the y-coordinate.
Sourcepub fn deserialize_compressed(bytes: &[u8]) -> Result<Self>
pub fn deserialize_compressed(bytes: &[u8]) -> Result<Self>
Deserialize a point from compressed format.
Recovers the y-coordinate from the x-coordinate and the compression flag. Returns an error if the bytes don’t represent a valid point.
Sourcepub fn add(&self, other: &Self) -> Self
pub fn add(&self, other: &Self) -> Self
Constant-time Affine addition. Computes both addition and doubling paths and selects valid one. Handles division-by-zero safely via dummy inversion.
Trait Implementations§
Source§impl ConditionallySelectable for Point
impl ConditionallySelectable for Point
Source§fn conditional_select(a: &Self, b: &Self, choice: Choice) -> Self
fn conditional_select(a: &Self, b: &Self, choice: Choice) -> Self
Source§fn conditional_assign(&mut self, other: &Self, choice: Choice)
fn conditional_assign(&mut self, other: &Self, choice: Choice)
Source§fn conditional_swap(a: &mut Self, b: &mut Self, choice: Choice)
fn conditional_swap(a: &mut Self, b: &mut Self, choice: Choice)
Conditionally swap
self and other if choice == 1; otherwise,
reassign both unto themselves. Read moreimpl Copy for Point
impl Eq for Point
Auto Trait Implementations§
impl Freeze for Point
impl RefUnwindSafe for Point
impl Send for Point
impl Sync for Point
impl Unpin for Point
impl UnwindSafe for Point
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more