pub struct Point {
pub x: BigNumber,
pub y: BigNumber,
pub inf: bool,
}Expand description
A point on the secp256k1 curve in affine coordinates (x, y).
The point at infinity is represented by inf == true (x and y are zero).
Fields§
§x: BigNumberThe x-coordinate.
y: BigNumberThe y-coordinate.
inf: boolWhether this is the point at infinity.
Implementations§
Source§impl Point
impl Point
Sourcepub fn is_infinity(&self) -> bool
pub fn is_infinity(&self) -> bool
Check if this is the point at infinity.
Sourcepub fn validate(&self) -> bool
pub fn validate(&self) -> bool
Validate that this point lies on the secp256k1 curve. Returns true if y^2 = x^3 + 7 (mod p).
Sourcepub fn from_x(x: &BigNumber, odd: bool) -> Result<Self, PrimitivesError>
pub fn from_x(x: &BigNumber, odd: bool) -> Result<Self, PrimitivesError>
Recover a point from its x coordinate and y-parity.
odd = true means y should be odd.
Sourcepub fn from_der(bytes: &[u8]) -> Result<Self, PrimitivesError>
pub fn from_der(bytes: &[u8]) -> Result<Self, PrimitivesError>
Parse a point from DER-encoded bytes (compressed or uncompressed).
Compressed format: 0x02/0x03 || x (33 bytes total) Uncompressed format: 0x04 || x || y (65 bytes total)
Sourcepub fn from_string(hex: &str) -> Result<Self, PrimitivesError>
pub fn from_string(hex: &str) -> Result<Self, PrimitivesError>
Parse a point from a hex string (DER encoded).
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 UnsafeUnpin 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