Skip to main content

NonIdentity

Struct NonIdentity 

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§

§

impl<P> NonIdentity<P>

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

Create a NonIdentity from a point.

§

impl<P> NonIdentity<P>

pub fn from_repr(repr: &<P as GroupEncoding>::Repr) -> CtOption<NonIdentity<P>>

Decode a NonIdentity from its encoding.

§

impl<P> NonIdentity<P>
where P: Copy,

pub fn to_point(self) -> P

Return wrapped point.

§

impl<P> NonIdentity<P>

pub fn random(rng: impl CryptoRng + RngCore) -> NonIdentity<P>

Generate a random NonIdentity<ProjectivePoint>.

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

Converts this element into its affine representation.

§

impl<P> NonIdentity<P>

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

Converts this element to its curve representation.

Trait Implementations§

§

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

§

fn as_ref(&self) -> &P

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

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

§

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

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
§

impl<P> ConditionallySelectable for NonIdentity<P>

§

fn conditional_select( a: &NonIdentity<P>, b: &NonIdentity<P>, choice: Choice, ) -> NonIdentity<P>

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
§

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

§

fn ct_eq(&self, other: &NonIdentity<P>) -> 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
§

impl<P> Deref for NonIdentity<P>

§

type Target = P

The resulting type after dereferencing.
§

fn deref(&self) -> &<NonIdentity<P> as Deref>::Target

Dereferences the value.
§

impl<C, P> From<&NonIdentity<P>> for PublicKey<C>

§

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

Converts to this type from the input type.
§

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

§

fn from( value: &PublicKey<C>, ) -> NonIdentity<<C as CurveArithmetic>::AffinePoint>

Converts to this type from the input type.
§

impl<C, P> From<NonIdentity<P>> for PublicKey<C>

§

fn from(value: NonIdentity<P>) -> PublicKey<C>

Converts to this type from the input type.
§

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

§

fn from(value: PublicKey<C>) -> NonIdentity<<C as CurveArithmetic>::AffinePoint>

Converts to this type from the input type.
§

impl<P> GroupEncoding for NonIdentity<P>

§

type Repr = <P as GroupEncoding>::Repr

The encoding of group elements. Read more
§

fn from_bytes( bytes: &<NonIdentity<P> as GroupEncoding>::Repr, ) -> CtOption<NonIdentity<P>>

Attempts to deserialize a group element from its encoding.
§

fn from_bytes_unchecked( bytes: &<NonIdentity<P> as GroupEncoding>::Repr, ) -> CtOption<NonIdentity<P>>

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

fn to_bytes(&self) -> <NonIdentity<P> as GroupEncoding>::Repr

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

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

§

type Output = NonIdentity<P>

The resulting type after applying the * operator.
§

fn mul( self, rhs: &NonZeroScalar<C>, ) -> <&NonIdentity<P> as Mul<&NonZeroScalar<C>>>::Output

Performs the * operation. Read more
§

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

§

type Output = NonIdentity<P>

The resulting type after applying the * operator.
§

fn mul( self, rhs: NonZeroScalar<C>, ) -> <NonIdentity<P> as Mul<NonZeroScalar<C>>>::Output

Performs the * operation. Read more
§

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

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

Source§

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

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V