tiny_ec_core::curve

Struct Jacobian

Source
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 From<&Jacobian> for Affine

Source§

fn from(value: &Jacobian) -> Self

Converts to this type from the input type.
Source§

impl From<Jacobian> for Affine

Source§

fn from(value: Jacobian) -> Self

Converts to this type from the input type.
Source§

impl Copy for Jacobian

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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 T
where 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> ToOwned for T
where T: Clone,

Source§

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 T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.