tiny_ec_core::curve

Struct Affine

Source
pub struct Affine {
    pub x: Field,
    pub y: Field,
    pub infinity: bool,
}
Expand description

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

Fields§

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

Implementations§

Source§

impl Affine

Source

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

Create a new affine.

Source

pub fn set_xy(&mut self, x: &Field, y: &Field)

Set a group element equal to the point with given X and Y coordinates.

Source

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

Set a group element (affine) equal to the point with the given X coordinate and a Y coordinate that is a quadratic residue modulo p. The return value is true iff a coordinate with the given X coordinate exists.

Source

pub fn set_xo_var(&mut self, x: &Field, odd: bool) -> bool

Set a group element (affine) equal to the point with the given X coordinate, and given oddness for Y. Return value indicates whether the result is valid.

Source

pub fn is_infinity(&self) -> bool

Check whether a group element is the point at infinity.

Source

pub fn is_valid_var(&self) -> bool

Check whether a group element is valid (i.e., on the curve).

Source

pub fn neg_in_place(&mut self, other: &Affine)

Source

pub fn neg(&self) -> Affine

Source

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

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

Source

pub fn from_gej(a: &Jacobian) -> Self

Source

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

Source

pub fn set_gej_zinv(&mut self, a: &Jacobian, zi: &Field)

Source

pub fn clear(&mut self)

Clear a secp256k1_ge to prevent leaking sensitive information.

Source§

impl Affine

Source

pub fn compose(x: &Field, z: &Field) -> Affine

Trait Implementations§

Source§

impl Clone for Affine

Source§

fn clone(&self) -> Affine

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 Affine

Source§

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

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

impl Default for Affine

Source§

fn default() -> Affine

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

impl<'de> Deserialize<'de> for Affine

Source§

fn deserialize<D>(deserializer: D) -> Result<Affine, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl From<&[u8]> for Affine

Source§

fn from(value: &[u8]) -> Self

Converts to this type from the input type.
Source§

impl From<&[u8; 64]> for Affine

Source§

fn from(value: &[u8; 64]) -> 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 From<AffineStorage> for Affine

Source§

fn from(a: AffineStorage) -> Affine

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 Into<[u8; 64]> for Affine

Source§

fn into(self) -> [u8; 64]

Converts this type into the (usually inferred) input type.
Source§

impl Into<AffineStorage> for Affine

Source§

fn into(self) -> AffineStorage

Converts this type into the (usually inferred) input type.
Source§

impl PartialEq for Affine

Source§

fn eq(&self, other: &Affine) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Affine

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Copy for Affine

Source§

impl Eq for Affine

Source§

impl StructuralPartialEq for Affine

Auto Trait Implementations§

§

impl Freeze for Affine

§

impl RefUnwindSafe for Affine

§

impl Send for Affine

§

impl Sync for Affine

§

impl Unpin for Affine

§

impl UnwindSafe for Affine

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.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,