Struct JubjubBase
pub struct JubjubBase(/* private fields */);Expand description
Represents an element of the scalar field Fq of the BLS12-381 elliptic curve construction.
The inner representation blst_fr is stored in Montgomery form as
little-endian u64 limbs.
Implementations§
§impl Fq
impl Fq
pub fn from_bytes_le(bytes: &[u8; 32]) -> CtOption<Fq>
pub fn from_bytes_le(bytes: &[u8; 32]) -> CtOption<Fq>
Attempts to convert a little-endian byte representation of
a scalar into a Fq, failing if the input is not canonical.
pub fn from_bytes_be(be_bytes: &[u8; 32]) -> CtOption<Fq>
pub fn from_bytes_be(be_bytes: &[u8; 32]) -> CtOption<Fq>
Attempts to convert a big-endian byte representation of
a scalar into a Fq, failing if the input is not canonical.
pub fn to_bytes_le(&self) -> [u8; 32]
pub fn to_bytes_le(&self) -> [u8; 32]
Converts an element of Fq into a byte representation in
little-endian byte order.
pub fn to_bytes_be(&self) -> [u8; 32]
pub fn to_bytes_be(&self) -> [u8; 32]
Converts an element of Fq into a byte representation in
big-endian byte order.
pub fn from_u64s_le(bytes: &[u64; 4]) -> CtOption<Fq>
pub fn char() -> <Fq as PrimeField>::Repr
pub fn num_bits(&self) -> u32
pub fn square_assign(&mut self)
pub fn square_assign(&mut self)
Calculates the square of this element.
Trait Implementations§
§impl ConditionallySelectable for Fq
impl ConditionallySelectable for Fq
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 more§impl ConstantTimeEq for Fq
impl ConstantTimeEq for Fq
§impl<'de> Deserialize<'de> for Fq
impl<'de> Deserialize<'de> for Fq
§fn deserialize<D>(d: D) -> Result<Fq, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(d: D) -> Result<Fq, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
§impl Field for Fq
impl Field for Fq
§fn random(rng: impl RngCore) -> Fq
fn random(rng: impl RngCore) -> Fq
§fn invert(&self) -> CtOption<Fq>
fn invert(&self) -> CtOption<Fq>
§fn sqrt(&self) -> CtOption<Fq>
fn sqrt(&self) -> CtOption<Fq>
§fn is_zero_vartime(&self) -> bool
fn is_zero_vartime(&self) -> bool
§fn pow_vartime<S>(&self, exp: S) -> Self
fn pow_vartime<S>(&self, exp: S) -> Self
Source§impl From<Position> for JubjubBase
impl From<Position> for JubjubBase
§impl FromUniformBytes<64> for Fq
impl FromUniformBytes<64> for Fq
§fn from_uniform_bytes(bytes: &[u8; 64]) -> Fq
fn from_uniform_bytes(bytes: &[u8; 64]) -> Fq
§impl Legendre for Fq
impl Legendre for Fq
§fn ct_quadratic_non_residue(&self) -> Choice
fn ct_quadratic_non_residue(&self) -> Choice
Choice(1) if this element is a quadratic non-residue.§fn ct_quadratic_residue(&self) -> Choice
fn ct_quadratic_residue(&self) -> Choice
Choice(1) if this element is a quadratic residue.
Note: 0 is considered a quadratic residue.§impl MapToEdwardsParams<Fq> for JubjubExtended
impl MapToEdwardsParams<Fq> for JubjubExtended
§impl Ord for Fq
impl Ord for Fq
§impl PartialOrd for Fq
impl PartialOrd for Fq
§impl PrimeField for Fq
impl PrimeField for Fq
§const ROOT_OF_UNITY_INV: Fq
const ROOT_OF_UNITY_INV: Fq
ROOT_OF_UNITY^-1
§const MODULUS: &'static str = "0x73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001"
const MODULUS: &'static str = "0x73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001"
Constant representing the modulus
§fn from_repr(repr: <Fq as PrimeField>::Repr) -> CtOption<Fq>
fn from_repr(repr: <Fq as PrimeField>::Repr) -> CtOption<Fq>
Converts a little-endian non-Montgomery form repr into a Montgomery
form Fq.
§fn to_repr(&self) -> <Fq as PrimeField>::Repr
fn to_repr(&self) -> <Fq as PrimeField>::Repr
Converts a Montgomery form Fq into little-endian non-Montgomery from.
§const CAPACITY: u32
const CAPACITY: u32
§const MULTIPLICATIVE_GENERATOR: Fq = GENERATOR
const MULTIPLICATIVE_GENERATOR: Fq = GENERATOR
modulus - 1 order. This element must also be
a quadratic nonresidue. Read more§const ROOT_OF_UNITY: Fq = ROOT_OF_UNITY
const ROOT_OF_UNITY: Fq = ROOT_OF_UNITY
2^s root of unity. Read more§type Repr = [u8; 32]
type Repr = [u8; 32]
§fn from_repr_vartime(repr: <Fq as PrimeField>::Repr) -> Option<Fq>
fn from_repr_vartime(repr: <Fq as PrimeField>::Repr) -> Option<Fq>
§fn from_str_vartime(s: &str) -> Option<Self>
fn from_str_vartime(s: &str) -> Option<Self>
§impl PrimeFieldBits for Fq
impl PrimeFieldBits for Fq
§fn to_le_bits(&self) -> BitArray<<Fq as PrimeFieldBits>::ReprBits>
fn to_le_bits(&self) -> BitArray<<Fq as PrimeFieldBits>::ReprBits>
§fn char_le_bits() -> BitArray<<Fq as PrimeFieldBits>::ReprBits>
fn char_le_bits() -> BitArray<<Fq as PrimeFieldBits>::ReprBits>
§impl SerdeObject for Fq
impl SerdeObject for Fq
§fn from_raw_bytes_unchecked(bytes: &[u8]) -> Fq
fn from_raw_bytes_unchecked(bytes: &[u8]) -> Fq
§fn from_raw_bytes(bytes: &[u8]) -> Option<Fq>
fn from_raw_bytes(bytes: &[u8]) -> Option<Fq>
§fn to_raw_bytes(&self) -> Vec<u8> ⓘ
fn to_raw_bytes(&self) -> Vec<u8> ⓘ
§fn read_raw_unchecked<R>(reader: &mut R) -> Fqwhere
R: Read,
fn read_raw_unchecked<R>(reader: &mut R) -> Fqwhere
R: Read,
§impl Serialize for Fq
impl Serialize for Fq
§fn serialize<S>(
&self,
s: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
s: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
impl Copy for Fq
impl Eq for Fq
Auto Trait Implementations§
impl Freeze for Fq
impl RefUnwindSafe for Fq
impl Send for Fq
impl Sync for Fq
impl Unpin for Fq
impl UnwindSafe for Fq
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> ConditionallyNegatable for T
impl<T> ConditionallyNegatable for T
Source§fn conditional_negate(&mut self, choice: Choice)
fn conditional_negate(&mut self, choice: Choice)
§impl<T> Conv for T
impl<T> Conv for T
§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.