pub struct Point { /* private fields */ }
Expand description
A point on the secp256k1 elliptic curve in affine coordinates
Implementations§
Source§impl Point
impl Point
Sourcepub fn new_uncompressed(x: &[u8; 32], y: &[u8; 32]) -> Result<Self>
pub fn new_uncompressed(x: &[u8; 32], y: &[u8; 32]) -> Result<Self>
Create a new point from uncompressed coordinates.
Returns an error if the coordinates don’t satisfy the curve equation.
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; 32]
pub fn x_coordinate_bytes(&self) -> [u8; 32]
Get the x-coordinate of this point as bytes.
Sourcepub fn y_coordinate_bytes(&self) -> [u8; 32]
pub fn y_coordinate_bytes(&self) -> [u8; 32]
Get the y-coordinate of this point as bytes.
Sourcepub fn serialize_uncompressed(&self) -> [u8; 65]
pub fn serialize_uncompressed(&self) -> [u8; 65]
Serialize this point in uncompressed format.
Sourcepub fn deserialize_uncompressed(bytes: &[u8]) -> Result<Self>
pub fn deserialize_uncompressed(bytes: &[u8]) -> Result<Self>
Deserialize a point from uncompressed format.
Returns an error if the bytes don’t represent a valid point.
Sourcepub fn serialize_compressed(&self) -> [u8; 33]
pub fn serialize_compressed(&self) -> [u8; 33]
Serialize this point in compressed format.
Sourcepub fn deserialize_compressed(bytes: &[u8]) -> Result<Self>
pub fn deserialize_compressed(bytes: &[u8]) -> Result<Self>
Deserialize a point from compressed format.
Returns an error if the bytes don’t represent a valid point.
Trait Implementations§
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