pub type Base = Fq;
Expand description
Represents an element of the base field $\mathbb{F}_q$ of the Jubjub elliptic curve construction.
Aliased Type§
struct Base(/* private fields */);
Implementations
Source§impl Scalar
impl Scalar
Sourcepub fn from_bytes(bytes: &[u8; 32]) -> CtOption<Scalar>
pub fn from_bytes(bytes: &[u8; 32]) -> CtOption<Scalar>
Attempts to convert a little-endian byte representation of
a scalar into a Scalar
, failing if the input is not canonical.
Sourcepub fn to_bytes(&self) -> [u8; 32]
pub fn to_bytes(&self) -> [u8; 32]
Converts an element of Scalar
into a byte representation in
little-endian byte order.
Sourcepub 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.
Sourcepub const fn from_raw(val: [u64; 4]) -> Scalar
pub const fn from_raw(val: [u64; 4]) -> Scalar
Converts from an integer represented in little endian
into its (congruent) Scalar
representation.
Sourcepub fn pow(&self, by: &[u64; 4]) -> Scalar
pub fn pow(&self, by: &[u64; 4]) -> Scalar
Exponentiates self
by by
, where by
is a
little-endian order integer exponent.
Sourcepub 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.
Trait Implementations
Source§impl<'b> AddAssign<&'b Scalar> for Scalar
impl<'b> AddAssign<&'b Scalar> for Scalar
Source§fn add_assign(&mut self, rhs: &'b Scalar)
fn add_assign(&mut self, rhs: &'b Scalar)
+=
operation. Read moreSource§impl AddAssign for Scalar
impl AddAssign for Scalar
Source§fn add_assign(&mut self, rhs: Scalar)
fn add_assign(&mut self, rhs: Scalar)
+=
operation. Read moreSource§impl ConditionallySelectable for Scalar
impl ConditionallySelectable for Scalar
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)
self
and other
if choice == 1
; otherwise,
reassign both unto themselves. Read moreSource§impl ConstantTimeEq for Scalar
impl ConstantTimeEq for Scalar
Source§impl Field for Scalar
impl Field for Scalar
Source§fn random(rng: impl RngCore) -> Scalar
fn random(rng: impl RngCore) -> Scalar
Source§fn invert(&self) -> CtOption<Scalar>
fn invert(&self) -> CtOption<Scalar>
Source§fn sqrt(&self) -> CtOption<Scalar>
fn sqrt(&self) -> CtOption<Scalar>
Source§fn is_zero_vartime(&self) -> bool
fn is_zero_vartime(&self) -> bool
Source§impl<'b> Mul<&'b G1Affine> for Scalar
impl<'b> Mul<&'b G1Affine> for Scalar
Source§type Output = G1Projective
type Output = G1Projective
*
operator.Source§impl<'b> Mul<&'b G1Projective> for Scalar
impl<'b> Mul<&'b G1Projective> for Scalar
Source§type Output = G1Projective
type Output = G1Projective
*
operator.Source§fn mul(self, rhs: &'b G1Projective) -> G1Projective
fn mul(self, rhs: &'b G1Projective) -> G1Projective
*
operation. Read moreSource§impl<'b> Mul<&'b G2Affine> for Scalar
impl<'b> Mul<&'b G2Affine> for Scalar
Source§type Output = G2Projective
type Output = G2Projective
*
operator.Source§impl<'b> Mul<&'b G2Projective> for Scalar
impl<'b> Mul<&'b G2Projective> for Scalar
Source§type Output = G2Projective
type Output = G2Projective
*
operator.Source§fn mul(self, rhs: &'b G2Projective) -> G2Projective
fn mul(self, rhs: &'b G2Projective) -> G2Projective
*
operation. Read moreSource§impl Mul<G1Affine> for Scalar
impl Mul<G1Affine> for Scalar
Source§type Output = G1Projective
type Output = G1Projective
*
operator.Source§impl Mul<G1Projective> for Scalar
impl Mul<G1Projective> for Scalar
Source§type Output = G1Projective
type Output = G1Projective
*
operator.Source§fn mul(self, rhs: G1Projective) -> G1Projective
fn mul(self, rhs: G1Projective) -> G1Projective
*
operation. Read moreSource§impl Mul<G2Affine> for Scalar
impl Mul<G2Affine> for Scalar
Source§type Output = G2Projective
type Output = G2Projective
*
operator.Source§impl Mul<G2Projective> for Scalar
impl Mul<G2Projective> for Scalar
Source§type Output = G2Projective
type Output = G2Projective
*
operator.Source§fn mul(self, rhs: G2Projective) -> G2Projective
fn mul(self, rhs: G2Projective) -> G2Projective
*
operation. Read moreSource§impl<'b> MulAssign<&'b Scalar> for Scalar
impl<'b> MulAssign<&'b Scalar> for Scalar
Source§fn mul_assign(&mut self, rhs: &'b Scalar)
fn mul_assign(&mut self, rhs: &'b Scalar)
*=
operation. Read moreSource§impl MulAssign for Scalar
impl MulAssign for Scalar
Source§fn mul_assign(&mut self, rhs: Scalar)
fn mul_assign(&mut self, rhs: Scalar)
*=
operation. Read moreSource§impl PrimeField for Scalar
impl PrimeField for Scalar
Source§const CAPACITY: u32 = 254u32
const CAPACITY: u32 = 254u32
Source§type Repr = [u8; 32]
type Repr = [u8; 32]
Source§fn from_repr(r: <Scalar as PrimeField>::Repr) -> CtOption<Scalar>
fn from_repr(r: <Scalar as PrimeField>::Repr) -> CtOption<Scalar>
Source§fn to_repr(&self) -> <Scalar as PrimeField>::Repr
fn to_repr(&self) -> <Scalar as PrimeField>::Repr
Source§fn multiplicative_generator() -> Scalar
fn multiplicative_generator() -> Scalar
modulus - 1
order. This element must
also be a quadratic nonresidue. Read moreSource§fn root_of_unity() -> Scalar
fn root_of_unity() -> Scalar
2^s
root of unity. Read moreSource§fn from_str_vartime(s: &str) -> Option<Self>
fn from_str_vartime(s: &str) -> Option<Self>
Source§impl PrimeFieldBits for Scalar
impl PrimeFieldBits for Scalar
Source§fn to_le_bits(&self) -> BitArray<<Scalar as PrimeFieldBits>::ReprBits>
fn to_le_bits(&self) -> BitArray<<Scalar as PrimeFieldBits>::ReprBits>
Source§fn char_le_bits() -> BitArray<<Scalar as PrimeFieldBits>::ReprBits>
fn char_le_bits() -> BitArray<<Scalar as PrimeFieldBits>::ReprBits>
Source§impl<'b> SubAssign<&'b Scalar> for Scalar
impl<'b> SubAssign<&'b Scalar> for Scalar
Source§fn sub_assign(&mut self, rhs: &'b Scalar)
fn sub_assign(&mut self, rhs: &'b Scalar)
-=
operation. Read moreSource§impl SubAssign for Scalar
impl SubAssign for Scalar
Source§fn sub_assign(&mut self, rhs: Scalar)
fn sub_assign(&mut self, rhs: Scalar)
-=
operation. Read more