pub struct Fr(pub [u64; 4]);
Expand description
Bls12 381 curve scalar field
Tuple Fields§
§0: [u64; 4]
Implementations§
source§impl Fr
impl Fr
pub const fn to_mont_form(val: [u64; 4]) -> Fr
pub const fn inner(&self) -> [u64; 4]
pub fn from_hex(hex: &str) -> Result<Fr, Error>
pub fn to_costomized_repr(self) -> Vec<u8>
pub fn is_odd(self) -> bool
pub fn pow_vartime(&self, by: &[u64; 4]) -> Fr
pub fn sqrt(&self) -> Option<Fr>
Trait Implementations§
source§impl<'b> AddAssign<&'b Fr> for Fr
impl<'b> AddAssign<&'b Fr> for Fr
source§fn add_assign(&mut self, rhs: &'b Fr)
fn add_assign(&mut self, rhs: &'b Fr)
Performs the
+=
operation. Read moresource§impl AddAssign for Fr
impl AddAssign for Fr
source§fn add_assign(&mut self, rhs: Fr)
fn add_assign(&mut self, rhs: Fr)
Performs the
+=
operation. Read moresource§impl Decode for Fr
impl Decode for Fr
source§impl<'de> Deserialize<'de> for Fr
impl<'de> Deserialize<'de> for Fr
source§fn deserialize<__D>(
__deserializer: __D
) -> Result<Fr, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<Fr, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl DivAssign for Fr
impl DivAssign for Fr
source§fn div_assign(&mut self, rhs: Fr)
fn div_assign(&mut self, rhs: Fr)
Performs the
/=
operation. Read moresource§impl Encode for Fr
impl Encode for Fr
source§fn encode_to<__CodecOutputEdqy>(
&self,
__codec_dest_edqy: &mut __CodecOutputEdqy
)
fn encode_to<__CodecOutputEdqy>( &self, __codec_dest_edqy: &mut __CodecOutputEdqy )
Convert self to a slice and append it to the destination.
source§fn using_encoded<R, F>(&self, f: F) -> R
fn using_encoded<R, F>(&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 Fr
impl FftField for Fr
const S: usize = 32usize
const ROOT_OF_UNITY: Fr = ROOT_OF_UNITY
const MULTIPLICATIVE_GENERATOR: Fr = MULTIPLICATIVE_GENERATOR
fn pow(self, val: u64) -> Fr
fn pow_of_2(by: u64) -> Fr
fn divn(&mut self, n: u32)
fn from_bytes_wide(bytes: &[u8; 64]) -> Fr
fn from_hash(hash: &[u8; 64]) -> Fr
fn to_raw_bytes(&self) -> [u8; 32]
fn reduce(&self) -> Fr
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 G1Projective> for &'a Fr
impl<'a, 'b> Mul<&'b G1Projective> for &'a Fr
§type Output = G1Projective
type Output = G1Projective
The resulting type after applying the
*
operator.source§fn mul(self, rhs: &'b G1Projective) -> <&'a Fr as Mul<&'b G1Projective>>::Output
fn mul(self, rhs: &'b G1Projective) -> <&'a Fr as Mul<&'b G1Projective>>::Output
Performs the
*
operation. Read moresource§impl<'a> Mul<&'a G1Projective> for Fr
impl<'a> Mul<&'a G1Projective> for Fr
§type Output = G1Projective
type Output = G1Projective
The resulting type after applying the
*
operator.source§fn mul(self, rhs: &'a G1Projective) -> <Fr as Mul<&'a G1Projective>>::Output
fn mul(self, rhs: &'a G1Projective) -> <Fr as Mul<&'a G1Projective>>::Output
Performs the
*
operation. Read moresource§impl<'a, 'b> Mul<&'b G2Projective> for &'a Fr
impl<'a, 'b> Mul<&'b G2Projective> for &'a Fr
§type Output = G2Projective
type Output = G2Projective
The resulting type after applying the
*
operator.source§fn mul(self, rhs: &'b G2Projective) -> <&'a Fr as Mul<&'b G2Projective>>::Output
fn mul(self, rhs: &'b G2Projective) -> <&'a Fr as Mul<&'b G2Projective>>::Output
Performs the
*
operation. Read moresource§impl<'a> Mul<&'a G2Projective> for Fr
impl<'a> Mul<&'a G2Projective> for Fr
§type Output = G2Projective
type Output = G2Projective
The resulting type after applying the
*
operator.source§fn mul(self, rhs: &'a G2Projective) -> <Fr as Mul<&'a G2Projective>>::Output
fn mul(self, rhs: &'a G2Projective) -> <Fr as Mul<&'a G2Projective>>::Output
Performs the
*
operation. Read moresource§impl<'a> Mul<G1Projective> for &'a Fr
impl<'a> Mul<G1Projective> for &'a Fr
§type Output = G1Projective
type Output = G1Projective
The resulting type after applying the
*
operator.source§fn mul(self, rhs: G1Projective) -> <&'a Fr as Mul<G1Projective>>::Output
fn mul(self, rhs: G1Projective) -> <&'a Fr as Mul<G1Projective>>::Output
Performs the
*
operation. Read moresource§impl Mul<G1Projective> for Fr
impl Mul<G1Projective> for Fr
§type Output = G1Projective
type Output = G1Projective
The resulting type after applying the
*
operator.source§fn mul(self, rhs: G1Projective) -> <Fr as Mul<G1Projective>>::Output
fn mul(self, rhs: G1Projective) -> <Fr as Mul<G1Projective>>::Output
Performs the
*
operation. Read moresource§impl<'a> Mul<G2Projective> for &'a Fr
impl<'a> Mul<G2Projective> for &'a Fr
§type Output = G2Projective
type Output = G2Projective
The resulting type after applying the
*
operator.source§fn mul(self, rhs: G2Projective) -> <&'a Fr as Mul<G2Projective>>::Output
fn mul(self, rhs: G2Projective) -> <&'a Fr as Mul<G2Projective>>::Output
Performs the
*
operation. Read moresource§impl Mul<G2Projective> for Fr
impl Mul<G2Projective> for Fr
§type Output = G2Projective
type Output = G2Projective
The resulting type after applying the
*
operator.source§fn mul(self, rhs: G2Projective) -> <Fr as Mul<G2Projective>>::Output
fn mul(self, rhs: G2Projective) -> <Fr as Mul<G2Projective>>::Output
Performs the
*
operation. Read moresource§impl<'b> MulAssign<&'b Fr> for Fr
impl<'b> MulAssign<&'b Fr> for Fr
source§fn mul_assign(&mut self, rhs: &'b Fr)
fn mul_assign(&mut self, rhs: &'b Fr)
Performs the
*=
operation. Read moresource§impl MulAssign for Fr
impl MulAssign for Fr
source§fn mul_assign(&mut self, rhs: Fr)
fn mul_assign(&mut self, rhs: Fr)
Performs the
*=
operation. Read moresource§impl Ord for Fr
impl Ord for Fr
source§impl PartialOrd for Fr
impl PartialOrd for Fr
source§impl PrimeField for Fr
impl PrimeField for Fr
const MODULUS: Fr = _
const INV: u64 = 18_446_744_069_414_584_319u64
fn is_zero(self) -> bool
fn to_bits(self) -> Vec<u8>
fn to_nafs(self) -> Vec<Naf>
fn double(self) -> Fr
fn square(self) -> Fr
fn double_assign(&mut self)
fn square_assign(&mut self)
source§impl Serialize for Fr
impl Serialize for Fr
source§fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
source§impl<'b> SubAssign<&'b Fr> for Fr
impl<'b> SubAssign<&'b Fr> for Fr
source§fn sub_assign(&mut self, rhs: &'b Fr)
fn sub_assign(&mut self, rhs: &'b Fr)
Performs the
-=
operation. Read moresource§impl SubAssign for Fr
impl SubAssign for Fr
source§fn sub_assign(&mut self, rhs: Fr)
fn sub_assign(&mut self, rhs: Fr)
Performs the
-=
operation. Read moreimpl Basic for Fr
impl Copy for Fr
impl EncodeLike for Fr
impl Eq for Fr
impl Field for Fr
impl ParallelCmp for Fr
impl ParityCmp for Fr
impl RefOps for Fr
Auto Trait Implementations§
impl RefUnwindSafe for Fr
impl Send for Fr
impl Sync for Fr
impl Unpin for Fr
impl UnwindSafe for Fr
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