Struct plonk_pallet::BlsScalar [−]
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
impl Scalar
impl Scalar
pub const fn internal_repr(&self) -> &[u64; 4]
pub const fn internal_repr(&self) -> &[u64; 4]
Returns the internal representation of the Scalar.
Returns the bit representation of the given Scalar
as
an array of 256 bits represented as u8
.
pub fn from_bytes_wide(bytes: &[u8; 64]) -> Scalar
pub fn from_bytes_wide(bytes: &[u8; 64]) -> Scalar
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
.
Exponentiates self
by by
, where by
is a
little-endian order integer exponent.
pub fn pow_vartime(&self, by: &[u64; 4]) -> Scalar
pub fn pow_vartime(&self, by: &[u64; 4]) -> Scalar
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
pub fn add_assign(&mut self, rhs: &'b Scalar)
pub fn add_assign(&mut self, rhs: &'b Scalar)
Performs the +=
operation. Read more
pub fn add_assign(&mut self, rhs: Scalar)
pub fn add_assign(&mut self, rhs: Scalar)
Performs the +=
operation. Read more
impl ConditionallySelectable for Scalar
impl ConditionallySelectable for Scalar
impl ConstantTimeEq for Scalar
impl ConstantTimeEq for Scalar
Convert self to a slice and append it to the destination.
Convert self to an owned vector.
pub fn using_encoded<R, F>(&self, f: F) -> R where
F: FnOnce(&[u8]) -> R,
pub fn using_encoded<R, F>(&self, f: F) -> R where
F: FnOnce(&[u8]) -> R,
Convert self to a slice and then invoke the given closure with it.
If possible give a hint of expected size of the encoding. Read more
Calculates the encoded size. Read more
Performs the conversion.
pub fn mul_assign(&mut self, rhs: &'b Scalar)
pub fn mul_assign(&mut self, rhs: &'b Scalar)
Performs the *=
operation. Read more
pub fn mul_assign(&mut self, rhs: Scalar)
pub fn mul_assign(&mut self, rhs: Scalar)
Performs the *=
operation. Read more
impl PartialOrd<Scalar> for Scalar
impl PartialOrd<Scalar> for Scalar
pub fn partial_cmp(&self, other: &Scalar) -> Option<Ordering>
pub fn partial_cmp(&self, other: &Scalar) -> Option<Ordering>
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
impl Serializable<32_usize> for Scalar
impl Serializable<32_usize> for Scalar
Converts an element of Scalar
into a byte representation in
little-endian byte order.
Attempts to convert a little-endian byte representation of
a scalar into a Scalar
, failing if the input is not canonical.
type Error = Error
type Error = Error
The type returned in the event of a conversion error.
pub fn sub_assign(&mut self, rhs: &'b Scalar)
pub fn sub_assign(&mut self, rhs: &'b Scalar)
Performs the -=
operation. Read more
pub fn sub_assign(&mut self, rhs: Scalar)
pub fn sub_assign(&mut self, rhs: Scalar)
Performs the -=
operation. Read more
impl EncodeLike<Scalar> for Scalar
impl StructuralEq for Scalar
Auto Trait Implementations
impl RefUnwindSafe for Scalar
impl UnwindSafe for Scalar
Blanket Implementations
Mutably borrows from an owned value. Read more
fn checked_from<T>(t: T) -> Option<Self> where
Self: TryFrom<T>,
fn checked_from<T>(t: T) -> Option<Self> where
Self: TryFrom<T>,
Convert from a value of T
into an equivalent instance of Option<Self>
. Read more
fn checked_into<T>(self) -> Option<T> where
Self: TryInto<T>,
fn checked_into<T>(self) -> Option<T> where
Self: TryInto<T>,
Consume self to return Some
equivalent value of Option<T>
. 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
impl<T, const N: usize> DeserializableSlice<N> for T where
T: Serializable<N>,
impl<T, const N: usize> DeserializableSlice<N> for T where
T: Serializable<N>,
fn from_slice(buf: &[u8]) -> Result<Self, Self::Error> where
Self::Error: BadLength,
fn from_slice(buf: &[u8]) -> Result<Self, Self::Error> where
Self::Error: BadLength,
Deserialize a slice of u8
into [Self
]
fn from_reader<R>(buf: &mut R) -> Result<Self, Self::Error> where
R: Read,
Self::Error: BadLength,
fn from_reader<R>(buf: &mut R) -> Result<Self, Self::Error> where
R: Read,
Self::Error: BadLength,
Deserialize the type reading the bytes from a reader. The bytes read are removed from the reader. Read more
pub fn blake2_128_concat(&self) -> Vec<u8, Global>ⓘ
pub fn twox_64_concat(&self) -> Vec<u8, Global>ⓘ
impl<T, const N: usize> ParseHexStr<N> for T where
T: Serializable<N>,
impl<T, const N: usize> ParseHexStr<N> for T where
T: Serializable<N>,
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 `
fn saturated_from<T>(t: T) -> Self where
Self: UniqueSaturatedFrom<T>,
fn saturated_from<T>(t: T) -> Self where
Self: UniqueSaturatedFrom<T>,
Convert from a value of T
into an equivalent instance of Self
. Read more
fn saturated_into<T>(self) -> T where
Self: UniqueSaturatedInto<T>,
fn saturated_into<T>(self) -> T where
Self: UniqueSaturatedInto<T>,
Consume self to return an equivalent value of T
. Read more
pub fn unchecked_into(self) -> T
pub fn unchecked_into(self) -> T
The counterpart to unchecked_from
.
pub fn unique_saturated_into(self) -> T
pub fn unique_saturated_into(self) -> T
Consume self to return an equivalent value of T
.
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