pub struct Fp(/* private fields */);
Expand description
Twisted Edwards curve Jubjub base field
Implementations§
source§impl Fp
impl Fp
pub const fn to_mont_form(val: [u64; 4]) -> Self
pub fn from_hex(hex: &str) -> Result<Fp, Error>
pub fn reduce(&self) -> Self
pub fn is_even(&self) -> bool
pub fn from_hash(hash: &[u8; 64]) -> Self
sourcepub fn mod_2_pow_k(&self, k: u8) -> u8
pub fn mod_2_pow_k(&self, k: u8) -> u8
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.
sourcepub fn mods_2_pow_k(&self, w: u8) -> i8
pub fn mods_2_pow_k(&self, w: u8) -> i8
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.
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 Decode for Fp
impl Decode for Fp
source§impl<'de> Deserialize<'de> for Fp
impl<'de> Deserialize<'de> for Fp
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl DivAssign for Fp
impl DivAssign for Fp
source§fn div_assign(&mut self, rhs: Fp)
fn div_assign(&mut self, rhs: Fp)
Performs the
/=
operation. Read moresource§impl Encode for Fp
impl Encode for Fp
source§fn encode_to<__CodecOutputEdqy: Output + ?Sized>(
&self,
__codec_dest_edqy: &mut __CodecOutputEdqy
)
fn encode_to<__CodecOutputEdqy: Output + ?Sized>( &self, __codec_dest_edqy: &mut __CodecOutputEdqy )
Convert self to a slice and append it to the destination.
source§fn using_encoded<R, F: FnOnce(&[u8]) -> R>(&self, f: F) -> R
fn using_encoded<R, F: FnOnce(&[u8]) -> R>(&self, f: F) -> R
Convert self to a slice and then invoke the given closure with it.
source§fn size_hint(&self) -> usize
fn size_hint(&self) -> usize
If possible give a hint of expected size of the encoding. Read more
source§fn encoded_size(&self) -> usize
fn encoded_size(&self) -> usize
Calculates the encoded size. Read more
source§impl FftField for Fp
impl FftField for Fp
const S: usize = 1usize
const ROOT_OF_UNITY: Self = ROOT_OF_UNITY
const MULTIPLICATIVE_GENERATOR: Self = MULTIPLICATIVE_GENERATOR
fn pow(self, val: u64) -> Self
fn pow_of_2(by: u64) -> Self
fn divn(&mut self, n: u32)
fn from_bytes_wide(bytes: &[u8; 64]) -> Self
fn from_hash(hash: &[u8; 64]) -> Self
fn to_raw_bytes(&self) -> [u8; 32]
fn reduce(&self) -> Self
fn is_even(&self) -> bool
fn mod_2_pow_k(&self, k: u8) -> u8
fn mods_2_pow_k(&self, w: u8) -> i8
source§impl<'a, 'b> Mul<&'b Fp> for &'a JubjubAffine
impl<'a, 'b> Mul<&'b Fp> for &'a JubjubAffine
source§impl<'a, 'b> Mul<&'b Fp> for &'a JubjubExtended
impl<'a, 'b> Mul<&'b Fp> for &'a JubjubExtended
source§impl<'a> Mul<&'a Fp> for JubjubAffine
impl<'a> Mul<&'a Fp> for JubjubAffine
source§impl<'a> Mul<&'a Fp> for JubjubExtended
impl<'a> Mul<&'a Fp> for JubjubExtended
source§impl<'a, 'b> Mul<&'b JubjubAffine> for &'a Fp
impl<'a, 'b> Mul<&'b JubjubAffine> for &'a Fp
§type Output = JubjubExtended
type Output = JubjubExtended
The resulting type after applying the
*
operator.source§impl<'a> Mul<&'a JubjubAffine> for Fp
impl<'a> Mul<&'a JubjubAffine> for Fp
§type Output = JubjubExtended
type Output = JubjubExtended
The resulting type after applying the
*
operator.source§impl<'a, 'b> Mul<&'b JubjubExtended> for &'a Fp
impl<'a, 'b> Mul<&'b JubjubExtended> for &'a Fp
§type Output = JubjubExtended
type Output = JubjubExtended
The resulting type after applying the
*
operator.source§impl<'a> Mul<&'a JubjubExtended> for Fp
impl<'a> Mul<&'a JubjubExtended> for Fp
§type Output = JubjubExtended
type Output = JubjubExtended
The resulting type after applying the
*
operator.source§impl<'a> Mul<Fp> for &'a JubjubAffine
impl<'a> Mul<Fp> for &'a JubjubAffine
source§impl<'a> Mul<Fp> for &'a JubjubExtended
impl<'a> Mul<Fp> for &'a JubjubExtended
source§impl Mul<Fp> for JubjubAffine
impl Mul<Fp> for JubjubAffine
§type Output = JubjubExtended
type Output = JubjubExtended
The resulting type after applying the
*
operator.source§impl Mul<Fp> for JubjubExtended
impl Mul<Fp> for JubjubExtended
§type Output = JubjubExtended
type Output = JubjubExtended
The resulting type after applying the
*
operator.source§impl<'a> Mul<JubjubAffine> for &'a Fp
impl<'a> Mul<JubjubAffine> for &'a Fp
§type Output = JubjubExtended
type Output = JubjubExtended
The resulting type after applying the
*
operator.source§impl Mul<JubjubAffine> for Fp
impl Mul<JubjubAffine> for Fp
§type Output = JubjubExtended
type Output = JubjubExtended
The resulting type after applying the
*
operator.source§fn mul(self, rhs: JubjubAffine) -> JubjubExtended
fn mul(self, rhs: JubjubAffine) -> JubjubExtended
Performs the
*
operation. Read moresource§impl<'a> Mul<JubjubExtended> for &'a Fp
impl<'a> Mul<JubjubExtended> for &'a Fp
§type Output = JubjubExtended
type Output = JubjubExtended
The resulting type after applying the
*
operator.source§impl Mul<JubjubExtended> for Fp
impl Mul<JubjubExtended> for Fp
§type Output = JubjubExtended
type Output = JubjubExtended
The resulting type after applying the
*
operator.source§fn mul(self, rhs: JubjubExtended) -> JubjubExtended
fn mul(self, rhs: JubjubExtended) -> JubjubExtended
Performs the
*
operation. Read moresource§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<'b> MulAssign<&'b Fp> for JubjubExtended
impl<'b> MulAssign<&'b Fp> for JubjubExtended
source§fn mul_assign(&mut self, rhs: &'b Fp)
fn mul_assign(&mut self, rhs: &'b Fp)
Performs the
*=
operation. Read moresource§impl MulAssign<Fp> for JubjubExtended
impl MulAssign<Fp> for JubjubExtended
source§fn mul_assign(&mut self, rhs: Fp)
fn mul_assign(&mut self, rhs: 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 PartialEq for Fp
impl PartialEq for Fp
source§impl PartialOrd for Fp
impl PartialOrd for Fp
source§impl PrimeField for Fp
impl PrimeField for Fp
const MODULUS: Self = _
const INV: u64 = 1_991_615_062_597_996_281u64
fn is_zero(self) -> bool
fn to_bits(self) -> Bits
fn to_nafs(self) -> Nafs
fn double(self) -> Self
fn square(self) -> Self
fn double_assign(&mut self)
fn square_assign(&mut self)
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 moreimpl Basic for Fp
impl Copy for Fp
impl EncodeLike for Fp
impl Eq for Fp
impl Field for Fp
impl ParallelCmp for Fp
impl ParityCmp for Fp
impl RefOps for Fp
Auto Trait Implementations§
impl RefUnwindSafe for Fp
impl Send for Fp
impl Sync for Fp
impl Unpin for Fp
impl UnwindSafe for Fp
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
Mutably borrows from an owned value. Read more