Struct ethers::core::k256::elliptic_curve::NonZeroScalar [−][src]
pub struct NonZeroScalar<C> where
C: Curve + ProjectiveArithmetic, { /* fields omitted */ }
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
Generate a random NonZeroScalar
pub fn from_repr(
repr: GenericArray<u8, <<C as Curve>::UInt as ArrayEncoding>::ByteSize>
) -> Option<NonZeroScalar<C>>
pub fn from_repr(
repr: GenericArray<u8, <<C as Curve>::UInt as ArrayEncoding>::ByteSize>
) -> Option<NonZeroScalar<C>>
Decode a NonZeroScalar
from a serialized field element
Create a NonZeroScalar
from a scalar.
Trait Implementations
impl<C> AsRef<<C as ScalarArithmetic>::Scalar> for NonZeroScalar<C> where
C: Curve + ProjectiveArithmetic,
impl<C> AsRef<<C as ScalarArithmetic>::Scalar> for NonZeroScalar<C> where
C: Curve + ProjectiveArithmetic,
Performs the conversion.
pub fn conditional_select(
a: &NonZeroScalar<C>,
b: &NonZeroScalar<C>,
choice: Choice
) -> NonZeroScalar<C>
pub fn conditional_select(
a: &NonZeroScalar<C>,
b: &NonZeroScalar<C>,
choice: Choice
) -> NonZeroScalar<C>
Select a
or b
according to choice
. Read more
Conditionally assign other
to self
, according to choice
. Read more
Determine if two items are equal. Read more
type Target = <C as ScalarArithmetic>::Scalar
type Target = <C as ScalarArithmetic>::Scalar
The resulting type after dereferencing.
Dereferences the value.
impl<'_, C> From<&'_ NonZeroScalar<C>> for GenericArray<u8, <<C as Curve>::UInt as ArrayEncoding>::ByteSize> where
C: Curve + ProjectiveArithmetic,
impl<'_, C> From<&'_ NonZeroScalar<C>> for GenericArray<u8, <<C as Curve>::UInt as ArrayEncoding>::ByteSize> where
C: Curve + ProjectiveArithmetic,
pub fn from(
scalar: &NonZeroScalar<C>
) -> GenericArray<u8, <<C as Curve>::UInt as ArrayEncoding>::ByteSize>
pub fn from(
scalar: &NonZeroScalar<C>
) -> GenericArray<u8, <<C as Curve>::UInt as ArrayEncoding>::ByteSize>
Performs the conversion.
Performs the conversion.
impl<'_, C> From<&'_ NonZeroScalar<C>> for ScalarBytes<C> where
C: Curve + ProjectiveArithmetic,
impl<'_, C> From<&'_ NonZeroScalar<C>> for ScalarBytes<C> where
C: Curve + ProjectiveArithmetic,
Performs the conversion.
Performs the conversion.
Performs the conversion.
impl<C> From<NonZeroScalar<C>> for GenericArray<u8, <<C as Curve>::UInt as ArrayEncoding>::ByteSize> where
C: Curve + ProjectiveArithmetic,
impl<C> From<NonZeroScalar<C>> for GenericArray<u8, <<C as Curve>::UInt as ArrayEncoding>::ByteSize> where
C: Curve + ProjectiveArithmetic,
pub fn from(
scalar: NonZeroScalar<C>
) -> GenericArray<u8, <<C as Curve>::UInt as ArrayEncoding>::ByteSize>
pub fn from(
scalar: NonZeroScalar<C>
) -> GenericArray<u8, <<C as Curve>::UInt as ArrayEncoding>::ByteSize>
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Perform a scalar inversion
type Output = <C as ScalarArithmetic>::Scalar
type Output = <C as ScalarArithmetic>::Scalar
Field element type
Performs the conversion.
impl<C> Zeroize for NonZeroScalar<C> where
C: Curve + ProjectiveArithmetic,
<C as ScalarArithmetic>::Scalar: Zeroize,
impl<C> Zeroize for NonZeroScalar<C> where
C: Curve + ProjectiveArithmetic,
<C as ScalarArithmetic>::Scalar: Zeroize,
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
pub fn as_slice_of<T>(&self) -> Result<&[T], Error> where
T: FromByteSlice,
pub fn base32_len(&self) -> usize
pub fn base32_len(&self) -> usize
Calculate the base32 serialized length
Mutably borrows from an owned value. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
pub fn write_base32<W>(
&self,
writer: &mut W
) -> Result<(), <W as WriteBase32>::Err> where
W: WriteBase32,
pub fn write_base32<W>(
&self,
writer: &mut W
) -> Result<(), <W as WriteBase32>::Err> where
W: WriteBase32,
Encode as base32 and write it to the supplied writer Implementations shouldn’t allocate. Read more
pub fn vzip(self) -> V
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more