Struct ethers::core::k256::elliptic_curve::ScalarBytes [−][src]
pub struct ScalarBytes<C> where
C: Curve, { /* fields omitted */ }
Expand description
Scalar bytes: wrapper for FieldBytes
which guarantees that the the
inner byte value is within range of the Curve::ORDER
.
Does not require an arithmetic implementation.
Implementations
pub fn new(
bytes: GenericArray<u8, <<C as Curve>::UInt as ArrayEncoding>::ByteSize>
) -> CtOption<ScalarBytes<C>>
pub fn new(
bytes: GenericArray<u8, <<C as Curve>::UInt as ArrayEncoding>::ByteSize>
) -> CtOption<ScalarBytes<C>>
Create new ScalarBytes
, checking that the given input is within
range of the Curve::ORDER
.
Create ScalarBytes
from the provided C::UInt
.
pub fn from_scalar(scalar: &<C as ScalarArithmetic>::Scalar) -> ScalarBytes<C> where
C: ProjectiveArithmetic,
pub fn from_scalar(scalar: &<C as ScalarArithmetic>::Scalar) -> ScalarBytes<C> where
C: ProjectiveArithmetic,
Convert from a Scalar
type for this curve.
Convert to a Scalar
type for this curve.
Convert into a Scalar
type for this curve.
Borrow the inner FieldBytes
Convert into FieldBytes
Create ScalarBytes
representing a value of zero.
Is this ScalarBytes
value all zeroes?
Trait Implementations
impl<C> AsRef<GenericArray<u8, <<C as Curve>::UInt as ArrayEncoding>::ByteSize>> for ScalarBytes<C> where
C: Curve,
impl<C> AsRef<GenericArray<u8, <<C as Curve>::UInt as ArrayEncoding>::ByteSize>> for ScalarBytes<C> where
C: Curve,
Performs the conversion.
pub fn conditional_select(
a: &ScalarBytes<C>,
b: &ScalarBytes<C>,
choice: Choice
) -> ScalarBytes<C>
pub fn conditional_select(
a: &ScalarBytes<C>,
b: &ScalarBytes<C>,
choice: Choice
) -> ScalarBytes<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
Returns the “default value” for a type. Read more
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.
impl<'_, C> From<&'_ ScalarBytes<C>> for GenericArray<u8, <<C as Curve>::UInt as ArrayEncoding>::ByteSize> where
C: Curve,
impl<'_, C> From<&'_ ScalarBytes<C>> for GenericArray<u8, <<C as Curve>::UInt as ArrayEncoding>::ByteSize> where
C: Curve,
pub fn from(
scalar_bytes: &ScalarBytes<C>
) -> GenericArray<u8, <<C as Curve>::UInt as ArrayEncoding>::ByteSize>
pub fn from(
scalar_bytes: &ScalarBytes<C>
) -> GenericArray<u8, <<C as Curve>::UInt as ArrayEncoding>::ByteSize>
Performs the conversion.
Performs the conversion.
impl<C> From<ScalarBytes<C>> for GenericArray<u8, <<C as Curve>::UInt as ArrayEncoding>::ByteSize> where
C: Curve,
impl<C> From<ScalarBytes<C>> for GenericArray<u8, <<C as Curve>::UInt as ArrayEncoding>::ByteSize> where
C: Curve,
pub fn from(
scalar_bytes: ScalarBytes<C>
) -> GenericArray<u8, <<C as Curve>::UInt as ArrayEncoding>::ByteSize>
pub fn from(
scalar_bytes: ScalarBytes<C>
) -> GenericArray<u8, <<C as Curve>::UInt as ArrayEncoding>::ByteSize>
Performs the conversion.
Performs the conversion.
impl<C> Copy for ScalarBytes<C> where
C: Curve,
GenericArray<u8, <<C as Curve>::UInt as ArrayEncoding>::ByteSize>: Copy,
Auto Trait Implementations
impl<C> RefUnwindSafe for ScalarBytes<C> where
<<<C as Curve>::UInt as ArrayEncoding>::ByteSize as ArrayLength<u8>>::ArrayType: RefUnwindSafe,
impl<C> Send for ScalarBytes<C>
impl<C> Sync for ScalarBytes<C>
impl<C> Unpin for ScalarBytes<C> where
<<<C as Curve>::UInt as ArrayEncoding>::ByteSize as ArrayLength<u8>>::ArrayType: Unpin,
impl<C> UnwindSafe for ScalarBytes<C> where
<<<C as Curve>::UInt as ArrayEncoding>::ByteSize as ArrayLength<u8>>::ArrayType: 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
Compare self to key
and return true
if they are equal.
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