Struct plonk_pallet::JubJubScalar [−][src]
pub struct JubJubScalar(_);
Expand description
Represents an element of the scalar field $\mathbb{F}_r$ of the Jubjub elliptic curve construction.
Implementations
Converts a 512-bit little endian integer into an element of Fr by reducing modulo r.
Converts from an integer represented in little endian
into its (congruent) Fr
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.
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.
Reduces bit representation of numbers, such that they can be evaluated in terms of the least significant bit.
Compute the result from Scalar (mod 2^k)
.
Panics
If the given k is > 32 (5 bits) as the value gets greater than the limb.
Compute the result from Scalar (mods k)
.
Panics
If the given k > 32 (5 bits)
|| k == 0
as the value gets
greater than the limb.
Trait Implementations
Performs the +=
operation. Read more
Performs the +=
operation. Read more
Performs the conversion.
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 Fr
into a byte representation in
little-endian byte order.
Attempts to convert a little-endian byte representation of
a field element into an element of Fr
, failing if the input
is not canonical (is not smaller than r).
type Error = Error
type Error = Error
The type returned in the event of a conversion error.
Performs the -=
operation. Read more
Performs the -=
operation. Read more
Auto Trait Implementations
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
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