pub struct Jacobian {
    pub x: Field,
    pub y: Field,
    pub z: Field,
    pub infinity: bool,
}
Expand description

A group element of the secp256k1 curve, in jacobian coordinates.

Fields§

§x: Field§y: Field§z: Field§infinity: bool

Implementations§

source§

impl Jacobian

source

pub const fn new(x: Field, y: Field) -> Self

Create a new jacobian.

source

pub fn set_infinity(&mut self)

Set a group element (jacobian) equal to the point at infinity.

source

pub fn set_ge(&mut self, a: &Affine)

Set a group element (jacobian) equal to another which is given in affine coordinates.

source

pub fn from_ge(a: &Affine) -> Self

source

pub fn eq_x_var(&self, x: &Field) -> bool

Compare the X coordinate of a group element (jacobian).

source

pub fn neg_in_place(&mut self, a: &Jacobian)

Set r equal to the inverse of a (i.e., mirrored around the X axis).

source

pub fn neg(&self) -> Jacobian

source

pub fn is_infinity(&self) -> bool

Check whether a group element is the point at infinity.

source

pub fn has_quad_y_var(&self) -> bool

Check whether a group element’s y coordinate is a quadratic residue.

source

pub fn double_nonzero_in_place(&mut self, a: &Jacobian, rzr: Option<&mut Field>)

Set r equal to the double of a. If rzr is not-NULL, r->z = a->z * *rzr (where infinity means an implicit z = 0). a may not be zero. Constant time.

source

pub fn double_var_in_place(&mut self, a: &Jacobian, rzr: Option<&mut Field>)

Set r equal to the double of a. If rzr is not-NULL, r->z = a->z * *rzr (where infinity means an implicit z = 0).

source

pub fn double_var(&self, rzr: Option<&mut Field>) -> Jacobian

source

pub fn add_var_in_place( &mut self, a: &Jacobian, b: &Jacobian, rzr: Option<&mut Field> )

Set r equal to the sum of a and b. If rzr is non-NULL, r->z = a->z * *rzr (a cannot be infinity in that case).

source

pub fn add_var(&self, b: &Jacobian, rzr: Option<&mut Field>) -> Jacobian

source

pub fn add_ge_in_place(&mut self, a: &Jacobian, b: &Affine)

Set r equal to the sum of a and b (with b given in affine coordinates, and not infinity).

source

pub fn add_ge(&self, b: &Affine) -> Jacobian

source

pub fn add_ge_var_in_place( &mut self, a: &Jacobian, b: &Affine, rzr: Option<&mut Field> )

Set r equal to the sum of a and b (with b given in affine coordinates). This is more efficient than secp256k1_gej_add_var. It is identical to secp256k1_gej_add_ge but without constant-time guarantee, and b is allowed to be infinity. If rzr is non-NULL, r->z = a->z * *rzr (a cannot be infinity in that case).

source

pub fn add_ge_var(&self, b: &Affine, rzr: Option<&mut Field>) -> Jacobian

source

pub fn add_zinv_var_in_place(&mut self, a: &Jacobian, b: &Affine, bzinv: &Field)

Set r equal to the sum of a and b (with the inverse of b’s Z coordinate passed as bzinv).

source

pub fn add_zinv_var(&mut self, b: &Affine, bzinv: &Field) -> Jacobian

source

pub fn clear(&mut self)

Clear a secp256k1_gej to prevent leaking sensitive information.

source

pub fn rescale(&mut self, s: &Field)

Rescale a jacobian point by b which must be non-zero. Constant-time.

Trait Implementations§

source§

impl Clone for Jacobian

source§

fn clone(&self) -> Jacobian

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Jacobian

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Jacobian

source§

fn default() -> Jacobian

Returns the “default value” for a type. Read more
source§

impl Copy for Jacobian

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.