Trait WeierstrassPoint

Source
pub trait WeierstrassPoint: Sized {
    type Coordinate: Field;

    const CURVE_A: Self::Coordinate;
    const CURVE_B: Self::Coordinate;
    const IDENTITY: Self;
Show 15 methods // Required methods fn as_le_bytes(&self) -> &[u8] ; fn from_xy_unchecked(x: Self::Coordinate, y: Self::Coordinate) -> Self; fn into_coords(self) -> (Self::Coordinate, Self::Coordinate); fn x(&self) -> &Self::Coordinate; fn y(&self) -> &Self::Coordinate; fn x_mut(&mut self) -> &mut Self::Coordinate; fn y_mut(&mut self) -> &mut Self::Coordinate; fn add_ne_nonidentity(&self, p2: &Self) -> Self; fn add_ne_assign_nonidentity(&mut self, p2: &Self); fn sub_ne_nonidentity(&self, p2: &Self) -> Self; fn sub_ne_assign_nonidentity(&mut self, p2: &Self); fn double_nonidentity(&self) -> Self; fn double_assign_nonidentity(&mut self); // Provided methods fn from_xy(x: Self::Coordinate, y: Self::Coordinate) -> Option<Self> where for<'a> &'a Self::Coordinate: Mul<&'a Self::Coordinate, Output = Self::Coordinate> { ... } fn from_xy_nonidentity( x: Self::Coordinate, y: Self::Coordinate, ) -> Option<Self> where for<'a> &'a Self::Coordinate: Mul<&'a Self::Coordinate, Output = Self::Coordinate> { ... }
}
Expand description

Short Weierstrass curve affine point.

Required Associated Constants§

Source

const CURVE_A: Self::Coordinate

The a coefficient in the Weierstrass curve equation y^2 = x^3 + a x + b.

Source

const CURVE_B: Self::Coordinate

The b coefficient in the Weierstrass curve equation y^2 = x^3 + a x + b.

Source

const IDENTITY: Self

Required Associated Types§

Required Methods§

Source

fn as_le_bytes(&self) -> &[u8]

The concatenated x, y coordinates of the affine point, where coordinates are in little endian.

Warning: The memory layout of Self is expected to pack x and y contigously with no unallocated space in between.

Source

fn from_xy_unchecked(x: Self::Coordinate, y: Self::Coordinate) -> Self

Raw constructor without asserting point is on the curve.

Source

fn into_coords(self) -> (Self::Coordinate, Self::Coordinate)

Source

fn x(&self) -> &Self::Coordinate

Source

fn y(&self) -> &Self::Coordinate

Source

fn x_mut(&mut self) -> &mut Self::Coordinate

Source

fn y_mut(&mut self) -> &mut Self::Coordinate

Source

fn add_ne_nonidentity(&self, p2: &Self) -> Self

Hazmat: Assumes self != +- p2 and self != identity and p2 != identity.

Source

fn add_ne_assign_nonidentity(&mut self, p2: &Self)

Hazmat: Assumes self != +- p2 and self != identity and p2 != identity.

Source

fn sub_ne_nonidentity(&self, p2: &Self) -> Self

Hazmat: Assumes self != +- p2 and self != identity and p2 != identity.

Source

fn sub_ne_assign_nonidentity(&mut self, p2: &Self)

Hazmat: Assumes self != +- p2 and self != identity and p2 != identity.

Source

fn double_nonidentity(&self) -> Self

Hazmat: Assumes self != identity and 2 * self != identity.

Source

fn double_assign_nonidentity(&mut self)

Hazmat: Assumes self != identity and 2 * self != identity.

Provided Methods§

Source

fn from_xy(x: Self::Coordinate, y: Self::Coordinate) -> Option<Self>
where for<'a> &'a Self::Coordinate: Mul<&'a Self::Coordinate, Output = Self::Coordinate>,

Source

fn from_xy_nonidentity(x: Self::Coordinate, y: Self::Coordinate) -> Option<Self>
where for<'a> &'a Self::Coordinate: Mul<&'a Self::Coordinate, Output = Self::Coordinate>,

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl WeierstrassPoint for Secp256k1Point

Source§

const CURVE_A: Secp256k1Coord = <Secp256k1Coord as openvm_algebra_guest::IntMod>::ZERO

Source§

const CURVE_B: Secp256k1Coord = CURVE_B

Source§

const IDENTITY: Self

Source§

type Coordinate = Secp256k1Coord

Source§

impl WeierstrassPoint for P256Point