Struct dusk_jubjub::JubJubScalar [−][src]
pub struct JubJubScalar(_);
Represents an element of the scalar field $\mathbb{F}_r$ of the Jubjub elliptic curve construction.
Implementations
impl Fr
[src]
impl Fr
[src]pub const fn zero() -> Fr
[src]
Returns zero, the additive identity.
pub const fn one() -> Fr
[src]
Returns one, the multiplicative identity.
pub const fn double(&self) -> Fr
[src]
Doubles this field element.
pub fn divn(&mut self, n: u32)
[src]
SHR impl
pub fn from_bytes_wide(bytes: &[u8; 64]) -> Fr
[src]
Converts a 512-bit little endian integer into an element of Fr by reducing modulo r.
pub const fn from_raw(val: [u64; 4]) -> Self
[src]
Converts from an integer represented in little endian
into its (congruent) Fr
representation.
pub const fn square(&self) -> Fr
[src]
Squares this element.
pub fn random<T>(rand: &mut T) -> Fr where
T: RngCore + CryptoRng,
[src]
T: RngCore + CryptoRng,
Generate a valid Scalar choosen uniformly using user- provided rng.
By rng
we mean any Rng that implements: Rng
+ CryptoRng
.
pub fn sqrt(&self) -> CtOption<Self>
[src]
Computes the square root of this element, if it exists.
pub fn pow(&self, by: &[u64; 4]) -> Self
[src]
Exponentiates self
by by
, where by
is a
little-endian order integer exponent.
pub fn pow_vartime(&self, by: &[u64; 4]) -> Self
[src]
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.
pub fn invert(&self) -> CtOption<Self>
[src]
Computes the multiplicative inverse of this element, failing if the element is zero.
pub const fn mul(&self, rhs: &Self) -> Self
[src]
Multiplies this element by another element
pub const fn sub(&self, rhs: &Self) -> Self
[src]
Subtracts another element from this element.
pub const fn add(&self, rhs: &Self) -> Self
[src]
Adds this element to another element.
pub const fn neg(&self) -> Self
[src]
Negates this element.
pub fn reduce(&self) -> Self
[src]
Reduces bit representation of numbers, such that they can be evaluated in terms of the least significant bit.
pub fn is_even(&self) -> bool
[src]
Evaluate if a Scalar, from Fr
is even or not.
pub fn mod_2_pow_k(&self, k: u8) -> u8
[src]
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.
pub fn mods_2_pow_k(&self, w: u8) -> i8
[src]
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.
pub fn compute_windowed_naf(&self, width: u8) -> [i8; 256]
[src]
Computes the windowed-non-adjacent for a given an element in the JubJub Scalar field.
Trait Implementations
impl ConditionallySelectable for Fr
[src]
impl ConditionallySelectable for Fr
[src]fn conditional_select(a: &Self, b: &Self, choice: Choice) -> Self
[src]
pub fn conditional_assign(&mut self, other: &Self, choice: Choice)
[src]
pub fn conditional_swap(a: &mut Self, b: &mut Self, choice: Choice)
[src]
impl Mul<&'_ Fr> for &ElgamalCipher
[src]
impl Mul<&'_ Fr> for &ElgamalCipher
[src]type Output = ElgamalCipher
The resulting type after applying the *
operator.
fn mul(self, rhs: &JubJubScalar) -> ElgamalCipher
[src]
impl<'a, 'b> Mul<&'b Fr> for &'a AffineNielsPoint
[src]
impl<'a, 'b> Mul<&'b Fr> for &'a AffineNielsPoint
[src]type Output = JubJubExtended
The resulting type after applying the *
operator.
fn mul(self, other: &'b Fr) -> JubJubExtended
[src]
impl<'b> Mul<&'b Fr> for AffineNielsPoint
[src]
impl<'b> Mul<&'b Fr> for AffineNielsPoint
[src]type Output = JubJubExtended
The resulting type after applying the *
operator.
fn mul(self, rhs: &'b Fr) -> JubJubExtended
[src]
impl<'a, 'b> Mul<&'b Fr> for &'a ExtendedNielsPoint
[src]
impl<'a, 'b> Mul<&'b Fr> for &'a ExtendedNielsPoint
[src]type Output = JubJubExtended
The resulting type after applying the *
operator.
fn mul(self, other: &'b Fr) -> JubJubExtended
[src]
impl<'b> Mul<&'b Fr> for ExtendedNielsPoint
[src]
impl<'b> Mul<&'b Fr> for ExtendedNielsPoint
[src]type Output = JubJubExtended
The resulting type after applying the *
operator.
fn mul(self, rhs: &'b Fr) -> JubJubExtended
[src]
impl<'a, 'b> Mul<&'b Fr> for &'a JubJubExtended
[src]
impl<'a, 'b> Mul<&'b Fr> for &'a JubJubExtended
[src]type Output = JubJubExtended
The resulting type after applying the *
operator.
fn mul(self, other: &'b Fr) -> JubJubExtended
[src]
impl<'b> Mul<&'b Fr> for JubJubExtended
[src]
impl<'b> Mul<&'b Fr> for JubJubExtended
[src]type Output = JubJubExtended
The resulting type after applying the *
operator.
fn mul(self, rhs: &'b Fr) -> JubJubExtended
[src]
impl Mul<Fr> for &ElgamalCipher
[src]
impl Mul<Fr> for &ElgamalCipher
[src]type Output = ElgamalCipher
The resulting type after applying the *
operator.
fn mul(self, rhs: JubJubScalar) -> ElgamalCipher
[src]
impl<'a> Mul<Fr> for &'a AffineNielsPoint
[src]
impl<'a> Mul<Fr> for &'a AffineNielsPoint
[src]type Output = JubJubExtended
The resulting type after applying the *
operator.
fn mul(self, rhs: Fr) -> JubJubExtended
[src]
impl Mul<Fr> for AffineNielsPoint
[src]
impl Mul<Fr> for AffineNielsPoint
[src]type Output = JubJubExtended
The resulting type after applying the *
operator.
fn mul(self, rhs: Fr) -> JubJubExtended
[src]
impl<'a> Mul<Fr> for &'a ExtendedNielsPoint
[src]
impl<'a> Mul<Fr> for &'a ExtendedNielsPoint
[src]type Output = JubJubExtended
The resulting type after applying the *
operator.
fn mul(self, rhs: Fr) -> JubJubExtended
[src]
impl Mul<Fr> for ExtendedNielsPoint
[src]
impl Mul<Fr> for ExtendedNielsPoint
[src]type Output = JubJubExtended
The resulting type after applying the *
operator.
fn mul(self, rhs: Fr) -> JubJubExtended
[src]
impl<'a> Mul<Fr> for &'a JubJubExtended
[src]
impl<'a> Mul<Fr> for &'a JubJubExtended
[src]type Output = JubJubExtended
The resulting type after applying the *
operator.
fn mul(self, rhs: Fr) -> JubJubExtended
[src]
impl Mul<Fr> for JubJubExtended
[src]
impl Mul<Fr> for JubJubExtended
[src]type Output = JubJubExtended
The resulting type after applying the *
operator.
fn mul(self, rhs: Fr) -> JubJubExtended
[src]
impl<'b> MulAssign<&'b Fr> for ElgamalCipher
[src]
impl<'b> MulAssign<&'b Fr> for ElgamalCipher
[src]fn mul_assign(&mut self, rhs: &'b JubJubScalar)
[src]
impl<'b> MulAssign<&'b Fr> for JubJubExtended
[src]
impl<'b> MulAssign<&'b Fr> for JubJubExtended
[src]fn mul_assign(&mut self, rhs: &'b Fr)
[src]
impl MulAssign<Fr> for ElgamalCipher
[src]
impl MulAssign<Fr> for ElgamalCipher
[src]fn mul_assign(&mut self, rhs: JubJubScalar)
[src]
impl MulAssign<Fr> for JubJubExtended
[src]
impl MulAssign<Fr> for JubJubExtended
[src]fn mul_assign(&mut self, rhs: Fr)
[src]
impl PartialOrd<Fr> for Fr
[src]
impl PartialOrd<Fr> for Fr
[src]impl Serializable<32_usize> for Fr
[src]
impl Serializable<32_usize> for Fr
[src]type Error = BytesError
The type returned in the event of a conversion error.
fn to_bytes(&self) -> [u8; 32]
[src]
Converts an element of Fr
into a byte representation in
little-endian byte order.
fn from_bytes(bytes: &[u8; 32]) -> Result<Self, Self::Error>
[src]
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).
pub const SIZE: usize
[src]
impl StructuralEq for Fr
[src]
impl StructuralEq for Fr
[src]Auto Trait Implementations
Blanket Implementations
impl<T> ConditionallyNegatable for T where
T: ConditionallySelectable,
&'a T: for<'a> Neg,
<&'a T as Neg>::Output == T,
[src]
impl<T> ConditionallyNegatable for T where
T: ConditionallySelectable,
&'a T: for<'a> Neg,
<&'a T as Neg>::Output == T,
[src]pub fn conditional_negate(&mut self, choice: Choice)
[src]
impl<T, const N: usize> DeserializableSlice<N> for T where
T: Serializable<N>,
[src]
impl<T, const N: usize> DeserializableSlice<N> for T where
T: Serializable<N>,
[src]impl<T, const N: usize> ParseHexStr<N> for T where
T: Serializable<N>,
[src]
impl<T, const N: usize> ParseHexStr<N> for T where
T: Serializable<N>,
[src]pub fn from_hex_str(s: &str) -> Result<Self, Self::Error> where
Self::Error: BadLength,
Self::Error: InvalidChar,
[src]
Self::Error: BadLength,
Self::Error: InvalidChar,