Skip to main content
A trait for interacting with Secp2561 curves. Provides operations needed to work with Secp256k1 and Secp256r1 elliptic curves. It includes methods for accessing curve parameters and creating curve points.

Signature

Examples

Trait functions

get_curve_size

Returns the order (size) of the curve’s underlying field. This is the number of points on the curve, also known as the curve order.

Signature

get_generator_point

Returns the generator point (G) for the curve. The generator point is a standard base point on the curve from which other points can be generated through scalar multiplication.

Signature

secp256_ec_new_syscall

Creates a new curve point from its x and y coordinates. Returns None if the provided coordinates don’t represent a valid point on the curve.

Signature

secp256_ec_get_point_from_x_syscall

Creates a curve point on the curve given its x-coordinate and y-parity.

Arguments

  • x - The x coordinate of the point
  • y_parity - If true, choose the odd y value; if false, choose the even y value

Returns

Returns Some(point) if a point exists with the given x coordinate, None otherwise.

Signature