[−][src]Struct dusk_jubjub::Fr
Represents an element of the scalar field $\mathbb{F}_r$ of the Jubjub elliptic curve construction.
Implementations
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(bytes: &[u8; 32]) -> CtOption<Fr>
[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 fn to_bytes(&self) -> [u8; 32]
[src]
Converts an element of Fr
into a byte representation in
little-endian byte order.
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<'a, 'b> Add<&'b Fr> for &'a Fr
[src]
type Output = Fr
The resulting type after applying the +
operator.
fn add(self, rhs: &'b Fr) -> Fr
[src]
impl<'b> Add<&'b Fr> for Fr
[src]
type Output = Fr
The resulting type after applying the +
operator.
fn add(self, rhs: &'b Fr) -> Fr
[src]
impl<'a> Add<Fr> for &'a Fr
[src]
impl Add<Fr> for Fr
[src]
impl<'b> AddAssign<&'b Fr> for Fr
[src]
fn add_assign(&mut self, rhs: &'b Fr)
[src]
impl AddAssign<Fr> for Fr
[src]
fn add_assign(&mut self, rhs: Fr)
[src]
impl Clone for Fr
[src]
impl ConditionallySelectable for Fr
[src]
fn conditional_select(a: &Self, b: &Self, choice: Choice) -> Self
[src]
fn conditional_assign(&mut self, other: &Self, choice: Choice)
[src]
fn conditional_swap(a: &mut Self, b: &mut Self, choice: Choice)
[src]
impl ConstantTimeEq for Fr
[src]
impl Copy for Fr
[src]
impl Debug for Fr
[src]
impl Default for Fr
[src]
impl Eq for Fr
[src]
impl<'a> From<&'a Fr> for [u8; 32]
[src]
impl From<Fr> for Fq
[src]
impl From<i8> for Fr
[src]
impl From<u64> for Fr
[src]
impl Index<usize> for Fr
[src]
impl IndexMut<usize> for Fr
[src]
impl<'a, 'b> Mul<&'b Fr> for &'a Fr
[src]
type Output = Fr
The resulting type after applying the *
operator.
fn mul(self, rhs: &'b Fr) -> Fr
[src]
impl<'b> Mul<&'b Fr> for Fr
[src]
type Output = Fr
The resulting type after applying the *
operator.
fn mul(self, rhs: &'b Fr) -> Fr
[src]
impl<'a, 'b> Mul<&'b Fr> for &'a AffineNielsPoint
[src]
type Output = ExtendedPoint
The resulting type after applying the *
operator.
fn mul(self, other: &'b Fr) -> ExtendedPoint
[src]
impl<'b> Mul<&'b Fr> for AffineNielsPoint
[src]
type Output = ExtendedPoint
The resulting type after applying the *
operator.
fn mul(self, rhs: &'b Fr) -> ExtendedPoint
[src]
impl<'a, 'b> Mul<&'b Fr> for &'a ExtendedNielsPoint
[src]
type Output = ExtendedPoint
The resulting type after applying the *
operator.
fn mul(self, other: &'b Fr) -> ExtendedPoint
[src]
impl<'b> Mul<&'b Fr> for ExtendedNielsPoint
[src]
type Output = ExtendedPoint
The resulting type after applying the *
operator.
fn mul(self, rhs: &'b Fr) -> ExtendedPoint
[src]
impl<'a, 'b> Mul<&'b Fr> for &'a ExtendedPoint
[src]
type Output = ExtendedPoint
The resulting type after applying the *
operator.
fn mul(self, other: &'b Fr) -> ExtendedPoint
[src]
impl<'b> Mul<&'b Fr> for ExtendedPoint
[src]
type Output = ExtendedPoint
The resulting type after applying the *
operator.
fn mul(self, rhs: &'b Fr) -> ExtendedPoint
[src]
impl<'a> Mul<Fr> for &'a Fr
[src]
impl Mul<Fr> for Fr
[src]
impl<'a> Mul<Fr> for &'a AffineNielsPoint
[src]
type Output = ExtendedPoint
The resulting type after applying the *
operator.
fn mul(self, rhs: Fr) -> ExtendedPoint
[src]
impl Mul<Fr> for AffineNielsPoint
[src]
type Output = ExtendedPoint
The resulting type after applying the *
operator.
fn mul(self, rhs: Fr) -> ExtendedPoint
[src]
impl<'a> Mul<Fr> for &'a ExtendedNielsPoint
[src]
type Output = ExtendedPoint
The resulting type after applying the *
operator.
fn mul(self, rhs: Fr) -> ExtendedPoint
[src]
impl Mul<Fr> for ExtendedNielsPoint
[src]
type Output = ExtendedPoint
The resulting type after applying the *
operator.
fn mul(self, rhs: Fr) -> ExtendedPoint
[src]
impl<'a> Mul<Fr> for &'a ExtendedPoint
[src]
type Output = ExtendedPoint
The resulting type after applying the *
operator.
fn mul(self, rhs: Fr) -> ExtendedPoint
[src]
impl Mul<Fr> for ExtendedPoint
[src]
type Output = ExtendedPoint
The resulting type after applying the *
operator.
fn mul(self, rhs: Fr) -> ExtendedPoint
[src]
impl<'b> MulAssign<&'b Fr> for Fr
[src]
fn mul_assign(&mut self, rhs: &'b Fr)
[src]
impl<'b> MulAssign<&'b Fr> for ExtendedPoint
[src]
fn mul_assign(&mut self, rhs: &'b Fr)
[src]
impl MulAssign<Fr> for Fr
[src]
fn mul_assign(&mut self, rhs: Fr)
[src]
impl MulAssign<Fr> for ExtendedPoint
[src]
fn mul_assign(&mut self, rhs: Fr)
[src]
impl<'a> Neg for &'a Fr
[src]
impl Neg for Fr
[src]
impl Ord for Fr
[src]
fn cmp(&self, other: &Self) -> Ordering
[src]
#[must_use]fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self
[src]
impl PartialEq<Fr> for Fr
[src]
impl PartialOrd<Fr> for Fr
[src]
fn partial_cmp(&self, other: &Fr) -> Option<Ordering>
[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl StructuralEq for Fr
[src]
impl<'a, 'b> Sub<&'b Fr> for &'a Fr
[src]
type Output = Fr
The resulting type after applying the -
operator.
fn sub(self, rhs: &'b Fr) -> Fr
[src]
impl<'b> Sub<&'b Fr> for Fr
[src]
type Output = Fr
The resulting type after applying the -
operator.
fn sub(self, rhs: &'b Fr) -> Fr
[src]
impl<'a> Sub<Fr> for &'a Fr
[src]
impl Sub<Fr> for Fr
[src]
impl<'b> SubAssign<&'b Fr> for Fr
[src]
fn sub_assign(&mut self, rhs: &'b Fr)
[src]
impl SubAssign<Fr> for Fr
[src]
fn sub_assign(&mut self, rhs: Fr)
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> ConditionallyNegatable for T where
T: ConditionallySelectable,
&'a T: for<'a> Neg,
<&'a T as Neg>::Output == T,
[src]
T: ConditionallySelectable,
&'a T: for<'a> Neg,
<&'a T as Neg>::Output == T,
fn conditional_negate(&mut self, choice: Choice)
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,