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>
impl<P> NonIdentity<P>
pub fn new(point: P) -> CtOption<NonIdentity<P>>
pub fn new(point: P) -> CtOption<NonIdentity<P>>
Create a NonIdentity from a point.
§impl<P> NonIdentity<P>
impl<P> NonIdentity<P>
pub fn from_repr(repr: &<P as GroupEncoding>::Repr) -> CtOption<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,
impl<P> NonIdentity<P>where
P: Copy,
pub fn to_point(self) -> P
pub fn to_point(self) -> P
Return wrapped point.
§impl<P> NonIdentity<P>
impl<P> NonIdentity<P>
pub fn random(rng: impl CryptoRng + RngCore) -> 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>
pub fn to_affine(self) -> NonIdentity<<P as Curve>::AffineRepr>
Converts this element into its affine representation.
§impl<P> NonIdentity<P>where
P: PrimeCurveAffine,
impl<P> NonIdentity<P>where
P: PrimeCurveAffine,
pub fn to_curve(self) -> NonIdentity<<P as PrimeCurveAffine>::Curve>
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>
impl<P> AsRef<P> for NonIdentity<P>
§impl<P> Clone for NonIdentity<P>where
P: Clone,
impl<P> Clone for NonIdentity<P>where
P: Clone,
§fn clone(&self) -> NonIdentity<P>
fn clone(&self) -> NonIdentity<P>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read more§impl<P> ConditionallySelectable for NonIdentity<P>where
P: ConditionallySelectable,
impl<P> ConditionallySelectable for NonIdentity<P>where
P: ConditionallySelectable,
§fn conditional_select(
a: &NonIdentity<P>,
b: &NonIdentity<P>,
choice: Choice,
) -> NonIdentity<P>
fn conditional_select( a: &NonIdentity<P>, b: &NonIdentity<P>, choice: Choice, ) -> NonIdentity<P>
Source§fn conditional_assign(&mut self, other: &Self, choice: Choice)
fn conditional_assign(&mut self, other: &Self, choice: Choice)
Source§fn conditional_swap(a: &mut Self, b: &mut Self, choice: Choice)
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,
impl<P> ConstantTimeEq for NonIdentity<P>where
P: ConstantTimeEq,
§impl<P> Deref for NonIdentity<P>
impl<P> Deref for NonIdentity<P>
§impl<C, P> From<&NonIdentity<P>> for PublicKey<C>
impl<C, P> From<&NonIdentity<P>> for PublicKey<C>
§fn from(value: &NonIdentity<P>) -> 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,
impl<C> From<&PublicKey<C>> for NonIdentity<<C as CurveArithmetic>::AffinePoint>where
C: CurveArithmetic,
§fn from(
value: &PublicKey<C>,
) -> NonIdentity<<C as CurveArithmetic>::AffinePoint>
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>
impl<C, P> From<NonIdentity<P>> for PublicKey<C>
§fn from(value: NonIdentity<P>) -> 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,
impl<C> From<PublicKey<C>> for NonIdentity<<C as CurveArithmetic>::AffinePoint>where
C: CurveArithmetic,
§fn from(value: PublicKey<C>) -> NonIdentity<<C as CurveArithmetic>::AffinePoint>
fn from(value: PublicKey<C>) -> NonIdentity<<C as CurveArithmetic>::AffinePoint>
Converts to this type from the input type.
§impl<P> GroupEncoding for NonIdentity<P>
impl<P> GroupEncoding for NonIdentity<P>
§type Repr = <P as GroupEncoding>::Repr
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>>
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>>
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
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>
impl<C, P> Mul<&NonZeroScalar<C>> for &NonIdentity<P>
§type Output = NonIdentity<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
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>
impl<C, P> Mul<NonZeroScalar<C>> for NonIdentity<P>
§type Output = NonIdentity<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
fn mul( self, rhs: NonZeroScalar<C>, ) -> <NonIdentity<P> as Mul<NonZeroScalar<C>>>::Output
Performs the
* operation. Read moreimpl<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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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