pub type Scalar = Fp;
Expand description
The scalar field of the Vesta and iso-Vesta curves.
Aliased Type§
struct Scalar(/* private fields */);
Implementations
Trait Implementations
Source§impl<'b> AddAssign<&'b Fp> for Fp
impl<'b> AddAssign<&'b Fp> for Fp
Source§fn add_assign(&mut self, rhs: &'b Fp)
fn add_assign(&mut self, rhs: &'b Fp)
Performs the
+=
operation. Read moreSource§impl AddAssign for Fp
impl AddAssign for Fp
Source§fn add_assign(&mut self, rhs: Fp)
fn add_assign(&mut self, rhs: Fp)
Performs the
+=
operation. Read moreSource§impl ConditionallySelectable for Fp
impl ConditionallySelectable for Fp
Source§fn conditional_select(a: &Self, b: &Self, choice: Choice) -> Self
fn conditional_select(a: &Self, b: &Self, choice: Choice) -> Self
Source§fn conditional_assign(&mut self, other: &Self, choice: Choice)
fn conditional_assign(&mut self, other: &Self, choice: Choice)
Source§fn conditional_swap(a: &mut Self, b: &mut Self, choice: Choice)
fn conditional_swap(a: &mut Self, b: &mut Self, choice: Choice)
Conditionally swap
self
and other
if choice == 1
; otherwise,
reassign both unto themselves. Read moreSource§impl ConstantTimeEq for Fp
impl ConstantTimeEq for Fp
Source§impl Field for Fp
impl Field for Fp
Source§fn invert(&self) -> CtOption<Self>
fn invert(&self) -> CtOption<Self>
Computes the multiplicative inverse of this element, failing if the element is zero.
Source§fn random(rng: impl RngCore) -> Self
fn random(rng: impl RngCore) -> Self
Returns an element chosen uniformly at random using a user-provided RNG.
Source§fn sqrt_ratio(num: &Self, div: &Self) -> (Choice, Self)
fn sqrt_ratio(num: &Self, div: &Self) -> (Choice, Self)
Computes: Read more
Source§fn pow_vartime<S: AsRef<[u64]>>(&self, exp: S) -> Self
fn pow_vartime<S: AsRef<[u64]>>(&self, exp: S) -> Self
Source§fn is_zero_vartime(&self) -> bool
fn is_zero_vartime(&self) -> bool
Returns true iff this element is zero. Read more
Source§impl FromUniformBytes<64> for Fp
impl FromUniformBytes<64> for Fp
Source§impl<'b> MulAssign<&'b Fp> for Fp
impl<'b> MulAssign<&'b Fp> for Fp
Source§fn mul_assign(&mut self, rhs: &'b Fp)
fn mul_assign(&mut self, rhs: &'b Fp)
Performs the
*=
operation. Read moreSource§impl MulAssign for Fp
impl MulAssign for Fp
Source§fn mul_assign(&mut self, rhs: Fp)
fn mul_assign(&mut self, rhs: Fp)
Performs the
*=
operation. Read moreSource§impl Ord for Fp
impl Ord for Fp
Source§impl PartialOrd for Fp
impl PartialOrd for Fp
Source§impl PrimeField for Fp
impl PrimeField for Fp
Source§const MODULUS: &'static str = "0x40000000000000000000000000000000224698fc094cf91b992d30ed00000001"
const MODULUS: &'static str = "0x40000000000000000000000000000000224698fc094cf91b992d30ed00000001"
Modulus of the field written as a string for debugging purposes. Read more
Source§const CAPACITY: u32 = 254u32
const CAPACITY: u32 = 254u32
How many bits of information can be reliably stored in the field element. Read more
Source§const MULTIPLICATIVE_GENERATOR: Self = GENERATOR
const MULTIPLICATIVE_GENERATOR: Self = GENERATOR
A fixed multiplicative generator of
modulus - 1
order. This element must also be
a quadratic nonresidue. Read moreSource§const ROOT_OF_UNITY: Self = ROOT_OF_UNITY
const ROOT_OF_UNITY: Self = ROOT_OF_UNITY
The
2^s
root of unity. Read moreSource§const ROOT_OF_UNITY_INV: Self
const ROOT_OF_UNITY_INV: Self
Inverse of
Self::ROOT_OF_UNITY
.Source§type Repr = [u8; 32]
type Repr = [u8; 32]
The prime field can be converted back and forth into this binary
representation.
Source§fn from_repr(repr: Self::Repr) -> CtOption<Self>
fn from_repr(repr: Self::Repr) -> CtOption<Self>
Attempts to convert a byte representation of a field element into an element of
this prime field, failing if the input is not canonical (is not smaller than the
field’s modulus). Read more
Source§fn to_repr(&self) -> Self::Repr
fn to_repr(&self) -> Self::Repr
Converts an element of the prime field into the standard byte representation for
this field. Read more
Source§fn from_str_vartime(s: &str) -> Option<Self>
fn from_str_vartime(s: &str) -> Option<Self>
Interpret a string of numbers as a (congruent) prime field element.
Does not accept unnecessary leading zeroes or a blank string. Read more
Source§impl PrimeFieldBits for Fp
impl PrimeFieldBits for Fp
Source§fn to_le_bits(&self) -> FieldBits<Self::ReprBits>
fn to_le_bits(&self) -> FieldBits<Self::ReprBits>
Converts an element of the prime field into a little-endian sequence of bits.
Source§fn char_le_bits() -> FieldBits<Self::ReprBits>
fn char_le_bits() -> FieldBits<Self::ReprBits>
Returns the bits of the field characteristic (the modulus) in little-endian order.
Source§impl<'b> SubAssign<&'b Fp> for Fp
impl<'b> SubAssign<&'b Fp> for Fp
Source§fn sub_assign(&mut self, rhs: &'b Fp)
fn sub_assign(&mut self, rhs: &'b Fp)
Performs the
-=
operation. Read moreSource§impl SubAssign for Fp
impl SubAssign for Fp
Source§fn sub_assign(&mut self, rhs: Fp)
fn sub_assign(&mut self, rhs: Fp)
Performs the
-=
operation. Read more