Struct dusk_jubjub::BlsScalar [−][src]
Expand description
Represents an element of the scalar field $\mathbb{F}_q$ of the BLS12-381 elliptic curve construction.
Tuple Fields
0: [u64; 4]
Implementations
Returns the internal representation of the Scalar.
Returns the bit representation of the given Scalar
as
an array of 256 bits represented as u8
.
Converts a 512-bit little endian integer into
a Scalar
by reducing by the modulus.
Converts from an integer represented in little endian
into its (congruent) Scalar
representation.
Generate a valid Scalar choosen uniformly using user- provided rng.
By rng
we mean any Rng that implements: Rng
+ CryptoRng
.
Reduces the scalar and returns it multiplied by the montgomery radix.
Exponentiates self
by by
, where by
is a
little-endian order integer exponent.
Exponentiates self
by by
, where by
is a
little-endian order integer exponent.
This operation is variable time with respect to the exponent. If the exponent is fixed, this operation is effectively constant time.
Computes the multiplicative inverse of this element, failing if the element is zero.
Trait Implementations
Performs the +=
operation. Read more
Performs the +=
operation. Read more
Performs the *=
operation. Read more
Performs the *=
operation. Read more
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
Converts an element of Scalar
into a byte representation in
little-endian byte order.
pub fn from_bytes(
buf: &[u8; 32]
) -> Result<Scalar, <Scalar as Serializable<32_usize>>::Error>
pub fn from_bytes(
buf: &[u8; 32]
) -> Result<Scalar, <Scalar as Serializable<32_usize>>::Error>
Attempts to convert a little-endian byte representation of
a scalar into a Scalar
, failing if the input is not canonical.
Performs the -=
operation. Read more
Performs the -=
operation. Read more
Auto Trait Implementations
impl RefUnwindSafe for Scalar
impl UnwindSafe for Scalar
Blanket Implementations
Mutably borrows from an owned value. Read more
impl<T> ConditionallyNegatable for T where
T: ConditionallySelectable,
&'a T: for<'a> Neg,
<&'a T as Neg>::Output == T,
impl<T> ConditionallyNegatable for T where
T: ConditionallySelectable,
&'a T: for<'a> Neg,
<&'a T as Neg>::Output == T,
Negate self
if choice == Choice(1)
; otherwise, leave it
unchanged. Read more
fn from_hex_str(s: &str) -> Result<Self, Self::Error> where
Self::Error: BadLength,
Self::Error: InvalidChar,
fn from_hex_str(s: &str) -> Result<Self, Self::Error> where
Self::Error: BadLength,
Self::Error: InvalidChar,
Parse a string slice as bytes hex representation and returns `