Struct elliptic_curve::NonZeroScalar
source · [−]pub struct NonZeroScalar<C> where
C: Curve + ScalarArithmetic, { /* private fields */ }
arithmetic
only.Expand description
Non-zero scalar type.
This type ensures that its value is not zero, ala core::num::NonZero*
.
To do this, the generic S
type must impl both Default
and
ConstantTimeEq
, with the requirement that S::default()
returns 0.
In the context of ECC, it’s useful for ensuring that scalar multiplication cannot result in the point at infinity.
Implementations
Create a NonZeroScalar
from a scalar.
Decode a NonZeroScalar
from a big endian-serialized field element.
Create a NonZeroScalar
from a C::UInt
.
Trait Implementations
impl<C> AsRef<<C as ScalarArithmetic>::Scalar> for NonZeroScalar<C> where
C: Curve + ScalarArithmetic,
impl<C> AsRef<<C as ScalarArithmetic>::Scalar> for NonZeroScalar<C> where
C: Curve + ScalarArithmetic,
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
impl<C> Mul<&'_ NonZeroScalar<C>> for NonZeroScalar<C> where
C: PrimeCurve + ScalarArithmetic,
impl<C> Mul<&'_ NonZeroScalar<C>> for NonZeroScalar<C> where
C: PrimeCurve + ScalarArithmetic,
type Output = NonZeroScalar<C>
type Output = NonZeroScalar<C>
The resulting type after applying the -
operator.
Performs the unary -
operation. Read more
impl<C, I> Reduce<I> for NonZeroScalar<C> where
C: Curve + ScalarArithmetic,
I: Integer + ArrayEncoding,
Scalar<C>: ReduceNonZero<I>,
impl<C, I> Reduce<I> for NonZeroScalar<C> where
C: Curve + ScalarArithmetic,
I: Integer + ArrayEncoding,
Scalar<C>: ReduceNonZero<I>,
Note: implementation is the same as ReduceNonZero
Perform a modular reduction, returning a field element.
Interpret the given byte array as a big endian integer and perform a modular reduction. Read more
Interpret the given byte array as a little endian integer and perform a modular reduction. Read more
fn from_be_digest_reduced<D>(digest: D) -> Self where
D: FixedOutput<OutputSize = UInt::ByteSize> + BlockInput + Clone + Default + Reset + Update,
fn from_be_digest_reduced<D>(digest: D) -> Self where
D: FixedOutput<OutputSize = UInt::ByteSize> + BlockInput + Clone + Default + Reset + Update,
digest
only.Interpret a digest as a big endian integer and perform a modular reduction. Read more
fn from_le_digest_reduced<D>(digest: D) -> Self where
D: FixedOutput<OutputSize = UInt::ByteSize> + BlockInput + Clone + Default + Reset + Update,
fn from_le_digest_reduced<D>(digest: D) -> Self where
D: FixedOutput<OutputSize = UInt::ByteSize> + BlockInput + Clone + Default + Reset + Update,
digest
only.Interpret a digest as a little endian integer and perform a modular reduction. Read more
impl<C, I> ReduceNonZero<I> for NonZeroScalar<C> where
C: Curve + ScalarArithmetic,
I: Integer + ArrayEncoding,
Scalar<C>: ReduceNonZero<I>,
impl<C, I> ReduceNonZero<I> for NonZeroScalar<C> where
C: Curve + ScalarArithmetic,
I: Integer + ArrayEncoding,
Scalar<C>: ReduceNonZero<I>,
Perform a modular reduction, returning a field element.
Auto Trait Implementations
impl<C> RefUnwindSafe for NonZeroScalar<C> where
<C as ScalarArithmetic>::Scalar: RefUnwindSafe,
impl<C> Send for NonZeroScalar<C>
impl<C> Sync for NonZeroScalar<C>
impl<C> Unpin for NonZeroScalar<C> where
<C as ScalarArithmetic>::Scalar: Unpin,
impl<C> UnwindSafe for NonZeroScalar<C> where
<C as ScalarArithmetic>::Scalar: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more