pub type Fq2 = QuadExtField<Fq>;
Aliased Type§
struct Fq2 { /* private fields */ }
Implementations§
Source§impl Fq2
impl Fq2
Sourcepub fn from_bytes(bytes: &[u8; 64]) -> CtOption<Fq2>
pub fn from_bytes(bytes: &[u8; 64]) -> CtOption<Fq2>
Attempts to convert a little-endian byte representation of
a scalar into a $base
, failing if the input is not canonical.
Sourcepub fn to_bytes(&self) -> [u8; 64]
pub fn to_bytes(&self) -> [u8; 64]
Converts an element of $base
into a byte representation in
little-endian byte order.
Sourcepub fn lexicographically_largest(&self) -> Choice
pub fn lexicographically_largest(&self) -> Choice
Returns whether or not this element is strictly lexicographically larger than its negation.
Source§impl<F: Field> QuadExtField<F>
impl<F: Field> QuadExtField<F>
pub const fn new(c0: F, c1: F) -> Self
pub const fn zero() -> Self
pub const fn one() -> Self
pub fn c0(&self) -> &F
pub fn c1(&self) -> &F
pub fn double(&self) -> Self
pub fn add(&self, other: &Self) -> Self
pub fn sub(&self, other: &Self) -> Self
pub fn neg(&self) -> Self
pub fn conjugate(&mut self)
Source§impl<F: ExtField> QuadExtField<F>where
Self: QuadExtFieldArith<Base = F>,
impl<F: ExtField> QuadExtField<F>where
Self: QuadExtFieldArith<Base = F>,
pub fn mul(&self, rhs: &Self) -> Self
pub fn mul_assign(&mut self, rhs: &Self)
pub fn square(el: &Self) -> Self
pub fn square_assign(&mut self)
pub fn norm(&self) -> F
Trait Implementations§
Source§impl<'b> AddAssign<&'b QuadExtField<Fq>> for Fq2
impl<'b> AddAssign<&'b QuadExtField<Fq>> for Fq2
Source§fn add_assign(&mut self, rhs: &'b Fq2)
fn add_assign(&mut self, rhs: &'b Fq2)
Performs the
+=
operation. Read moreSource§impl AddAssign for Fq2
impl AddAssign for Fq2
Source§fn add_assign(&mut self, rhs: Fq2)
fn add_assign(&mut self, rhs: Fq2)
Performs the
+=
operation. Read moreSource§impl EndianRepr for Fq2
impl EndianRepr for Fq2
Source§impl ExtField for Fq2
impl ExtField for Fq2
const NON_RESIDUE: Self
fn mul_by_nonresidue(&self) -> Self
fn frobenius_map(&mut self, power: usize)
Source§impl FromUniformBytes<96> for Fq2
impl FromUniformBytes<96> for Fq2
Source§fn from_uniform_bytes(bytes: &[u8; 96]) -> Self
fn from_uniform_bytes(bytes: &[u8; 96]) -> Self
Returns a field element that is congruent to the provided little endian unsigned
byte representation of an integer.
Source§impl<'b> MulAssign<&'b QuadExtField<Fq>> for Fq2
impl<'b> MulAssign<&'b QuadExtField<Fq>> for Fq2
Source§fn mul_assign(&mut self, rhs: &'b Fq2)
fn mul_assign(&mut self, rhs: &'b Fq2)
Performs the
*=
operation. Read moreSource§impl MulAssign for Fq2
impl MulAssign for Fq2
Source§fn mul_assign(&mut self, rhs: Fq2)
fn mul_assign(&mut self, rhs: Fq2)
Performs the
*=
operation. Read moreSource§impl Ord for Fq2
impl Ord for Fq2
Source§impl PartialOrd for Fq2
impl PartialOrd for Fq2
Source§impl PrimeField for Fq2
impl PrimeField for Fq2
Source§const MODULUS: &'static str = <Fq as PrimeField>::MODULUS
const MODULUS: &'static str = <Fq as PrimeField>::MODULUS
Modulus of the field written as a string for debugging purposes. Read more
Source§const MULTIPLICATIVE_GENERATOR: Self
const MULTIPLICATIVE_GENERATOR: Self
A fixed multiplicative generator of
modulus - 1
order. This element must also be
a quadratic nonresidue. Read moreSource§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 ROOT_OF_UNITY: Self
const ROOT_OF_UNITY: Self
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 = Repr<{ $base::SIZE * 2 }>
type Repr = Repr<{ $base::SIZE * 2 }>
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 QuadExtFieldArith for Fq2
impl QuadExtFieldArith for Fq2
const SQRT: SQRT<Fq>
type Base = Fq
fn square_assign(el: &mut QuadExtField<Self::Base>)
fn mul_assign( lhs: &mut QuadExtField<Self::Base>, rhs: &QuadExtField<Self::Base>, )
Source§impl SerdeObject for Fq2
impl SerdeObject for Fq2
Source§fn from_raw_bytes_unchecked(bytes: &[u8]) -> Self
fn from_raw_bytes_unchecked(bytes: &[u8]) -> Self
The purpose of unchecked functions is to read the internal memory
representation of a type from bytes as quickly as possible. No
sanitization checks are performed to ensure the bytes represent a
valid object. As such this function should only be used internally
as an extension of machine memory. It should not be used to deserialize
externally provided data.
fn from_raw_bytes(bytes: &[u8]) -> Option<Self>
fn to_raw_bytes(&self) -> Vec<u8> ⓘ
Source§fn read_raw_unchecked<R: Read>(reader: &mut R) -> Self
fn read_raw_unchecked<R: Read>(reader: &mut R) -> Self
The purpose of unchecked functions is to read the internal memory
representation of a type from disk as quickly as possible. No
sanitization checks are performed to ensure the bytes represent a
valid object. This function should only be used internally when some
machine state cannot be kept in memory (e.g., between runs)
and needs to be reloaded as quickly as possible.
fn read_raw<R: Read>(reader: &mut R) -> Result<Self>
fn write_raw<W: Write>(&self, writer: &mut W) -> Result<()>
Source§impl<'b> SubAssign<&'b QuadExtField<Fq>> for Fq2
impl<'b> SubAssign<&'b QuadExtField<Fq>> for Fq2
Source§fn sub_assign(&mut self, rhs: &'b Fq2)
fn sub_assign(&mut self, rhs: &'b Fq2)
Performs the
-=
operation. Read moreSource§impl SubAssign for Fq2
impl SubAssign for Fq2
Source§fn sub_assign(&mut self, rhs: Fq2)
fn sub_assign(&mut self, rhs: Fq2)
Performs the
-=
operation. Read moreSource§impl WithSmallOrderMulGroup<3> for Fq2
impl WithSmallOrderMulGroup<3> for Fq2
Source§impl<F: Clone + Field> Clone for QuadExtField<F>
impl<F: Clone + Field> Clone for QuadExtField<F>
Source§fn clone(&self) -> QuadExtField<F>
fn clone(&self) -> QuadExtField<F>
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<F: Field> ConditionallySelectable for QuadExtField<F>
impl<F: Field> ConditionallySelectable for QuadExtField<F>
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<F: Field> ConstantTimeEq for QuadExtField<F>
impl<F: Field> ConstantTimeEq for QuadExtField<F>
Source§impl<F: Default + Field> Default for QuadExtField<F>
impl<F: Default + Field> Default for QuadExtField<F>
Source§fn default() -> QuadExtField<F>
fn default() -> QuadExtField<F>
Returns the “default value” for a type. Read more
Source§impl<'de, F> Deserialize<'de> for QuadExtField<F>where
F: Deserialize<'de> + Field,
impl<'de, F> Deserialize<'de> for QuadExtField<F>where
F: Deserialize<'de> + Field,
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<F: ExtField> Field for QuadExtField<F>
impl<F: ExtField> Field for QuadExtField<F>
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(&self) -> CtOption<Self>
fn sqrt(&self) -> CtOption<Self>
Returns the square root of the field element, if it is
quadratic residue. Read more
Source§fn sqrt_ratio(_: &Self, _: &Self) -> (Choice, Self)
fn sqrt_ratio(_: &Self, _: &Self) -> (Choice, Self)
Computes: Read more
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 is_zero_vartime(&self) -> bool
fn is_zero_vartime(&self) -> bool
Returns true iff this element is zero. Read more