Struct elliptic_curve::point::NonIdentity

source ·
pub struct NonIdentity<P> { /* private fields */ }
Expand description

Non-identity point type.

This type ensures that its value is not the identity point, ala core::num::NonZero*.

In the context of ECC, it’s useful for ensuring that certain arithmetic cannot result in the identity point.

Implementations§

source§

impl<P> NonIdentity<P>

source

pub fn new(point: P) -> CtOption<Self>

Create a NonIdentity from a point.

source§

impl<P> NonIdentity<P>

source

pub fn from_repr(repr: &P::Repr) -> CtOption<Self>

Decode a NonIdentity from its encoding.

source§

impl<P: Copy> NonIdentity<P>

source

pub fn to_point(self) -> P

Return wrapped point.

source§

impl<P> NonIdentity<P>

source

pub fn random(rng: impl CryptoRng + RngCore) -> Self

Generate a random NonIdentity<ProjectivePoint>.

source

pub fn to_affine(self) -> NonIdentity<P::AffineRepr>

Converts this element into its affine representation.

source§

impl<P> NonIdentity<P>

source

pub fn to_curve(self) -> NonIdentity<P::Curve>

Converts this element to its curve representation.

Trait Implementations§

source§

impl<P> AsRef<P> for NonIdentity<P>

source§

fn as_ref(&self) -> &P

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl<P: Clone> Clone for NonIdentity<P>

source§

fn clone(&self) -> NonIdentity<P>

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<P> ConditionallySelectable for NonIdentity<P>

source§

fn conditional_select(a: &Self, b: &Self, choice: Choice) -> Self

Select a or b according to choice. Read more
source§

fn conditional_assign(&mut self, other: &Self, choice: Choice)

Conditionally assign other to self, according to choice. Read more
source§

fn conditional_swap(a: &mut Self, b: &mut Self, choice: Choice)

Conditionally swap self and other if choice == 1; otherwise, reassign both unto themselves. Read more
source§

impl<P> ConstantTimeEq for NonIdentity<P>
where P: ConstantTimeEq,

source§

fn ct_eq(&self, other: &Self) -> Choice

Determine if two items are equal. Read more
source§

fn ct_ne(&self, other: &Self) -> Choice

Determine if two items are NOT equal. Read more
source§

impl<P> Deref for NonIdentity<P>

§

type Target = P

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl<'de, P> Deserialize<'de> for NonIdentity<P>

source§

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

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

impl<C, P> From<&NonIdentity<P>> for PublicKey<C>
where C: CurveArithmetic, P: Copy + Into<AffinePoint<C>>,

source§

fn from(value: &NonIdentity<P>) -> Self

Converts to this type from the input type.
source§

impl<C> From<&PublicKey<C>> for NonIdentity<AffinePoint<C>>
where C: CurveArithmetic,

source§

fn from(value: &PublicKey<C>) -> Self

Converts to this type from the input type.
source§

impl<C, P> From<NonIdentity<P>> for PublicKey<C>
where C: CurveArithmetic, P: Copy + Into<AffinePoint<C>>,

source§

fn from(value: NonIdentity<P>) -> Self

Converts to this type from the input type.
source§

impl<C> From<PublicKey<C>> for NonIdentity<AffinePoint<C>>
where C: CurveArithmetic,

source§

fn from(value: PublicKey<C>) -> Self

Converts to this type from the input type.
source§

impl<P> GroupEncoding for NonIdentity<P>

§

type Repr = <P as GroupEncoding>::Repr

The encoding of group elements. Read more
source§

fn from_bytes(bytes: &Self::Repr) -> CtOption<Self>

Attempts to deserialize a group element from its encoding.
source§

fn from_bytes_unchecked(bytes: &Self::Repr) -> CtOption<Self>

Attempts to deserialize a group element, not checking if the element is valid. Read more
source§

fn to_bytes(&self) -> Self::Repr

Converts this element into its byte encoding. This may or may not support encoding the identity.
source§

impl<C, P> Mul<&NonZeroScalar<C>> for &NonIdentity<P>
where C: CurveArithmetic, P: Copy + Mul<Scalar<C>, Output = P>,

§

type Output = NonIdentity<P>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &NonZeroScalar<C>) -> Self::Output

Performs the * operation. Read more
source§

impl<C, P> Mul<NonZeroScalar<C>> for NonIdentity<P>
where C: CurveArithmetic, P: Copy + Mul<Scalar<C>, Output = P>,

§

type Output = NonIdentity<P>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: NonZeroScalar<C>) -> Self::Output

Performs the * operation. Read more
source§

impl<P> Serialize for NonIdentity<P>
where P: Serialize,

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<P: Copy> Copy for NonIdentity<P>

Auto Trait Implementations§

§

impl<P> Freeze for NonIdentity<P>
where P: Freeze,

§

impl<P> RefUnwindSafe for NonIdentity<P>
where P: RefUnwindSafe,

§

impl<P> Send for NonIdentity<P>
where P: Send,

§

impl<P> Sync for NonIdentity<P>
where P: Sync,

§

impl<P> Unpin for NonIdentity<P>
where P: Unpin,

§

impl<P> UnwindSafe for NonIdentity<P>
where P: UnwindSafe,

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: Copy,

source§

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

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

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

source§

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

🔬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> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where 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 T
where 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 T
where 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.
source§

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