Type Alias Fq2

Source
pub type Fq2 = QuadExtField<Fq>;

Aliased Type§

struct Fq2 { /* private fields */ }

Implementations§

Source§

impl Fq2

Source

pub const SIZE: usize = 64usize

Source§

impl Fq2

Source

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.

Source

pub fn to_bytes(&self) -> [u8; 64]

Converts an element of $base into a byte representation in little-endian byte order.

Source

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>

Source

pub const fn new(c0: F, c1: F) -> Self

Source

pub const fn zero() -> Self

Source

pub const fn one() -> Self

Source

pub fn c0(&self) -> &F

Source

pub fn c1(&self) -> &F

Source

pub fn double(&self) -> Self

Source

pub fn add(&self, other: &Self) -> Self

Source

pub fn sub(&self, other: &Self) -> Self

Source

pub fn neg(&self) -> Self

Source

pub fn conjugate(&mut self)

Source§

impl<F: ExtField> QuadExtField<F>
where Self: QuadExtFieldArith<Base = F>,

Source

pub fn mul(&self, rhs: &Self) -> Self

Source

pub fn mul_assign(&mut self, rhs: &Self)

Source

pub fn square(el: &Self) -> Self

Source

pub fn square_assign(&mut self)

Source

pub fn norm(&self) -> F

Trait Implementations§

Source§

impl<'a, 'b> Add<&'b QuadExtField<Fq>> for &'a Fq2

Source§

type Output = QuadExtField<Fq>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &'b Fq2) -> Fq2

Performs the + operation. Read more
Source§

impl<'b> Add<&'b QuadExtField<Fq>> for Fq2

Source§

type Output = QuadExtField<Fq>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &'b Fq2) -> Fq2

Performs the + operation. Read more
Source§

impl<'a> Add<QuadExtField<Fq>> for &'a Fq2

Source§

type Output = QuadExtField<Fq>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Fq2) -> Fq2

Performs the + operation. Read more
Source§

impl Add for Fq2

Source§

type Output = QuadExtField<Fq>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Fq2) -> Fq2

Performs the + operation. Read more
Source§

impl<'b> AddAssign<&'b QuadExtField<Fq>> for Fq2

Source§

fn add_assign(&mut self, rhs: &'b Fq2)

Performs the += operation. Read more
Source§

impl AddAssign for Fq2

Source§

fn add_assign(&mut self, rhs: Fq2)

Performs the += operation. Read more
Source§

impl EndianRepr for Fq2

Source§

const ENDIAN: Endian = Fq::ENDIAN

Source§

fn to_bytes(&self) -> Vec<u8>

Source§

fn from_bytes(bytes: &[u8]) -> CtOption<Self>

Source§

impl ExtField for Fq2

Source§

const NON_RESIDUE: Self

Source§

fn mul_by_nonresidue(&self) -> Self

Source§

fn frobenius_map(&mut self, power: usize)

Source§

impl From<u64> for Fq2

Source§

fn from(val: u64) -> Self

Converts to this type from the input type.
Source§

impl FromUniformBytes<96> for Fq2

Source§

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 Legendre for Fq2

Source§

impl<'a, 'b> Mul<&'b QuadExtField<Fq>> for &'a Fq2

Source§

type Output = QuadExtField<Fq>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &'b Fq2) -> Fq2

Performs the * operation. Read more
Source§

impl<'b> Mul<&'b QuadExtField<Fq>> for Fq2

Source§

type Output = QuadExtField<Fq>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &'b Fq2) -> Fq2

Performs the * operation. Read more
Source§

impl<'a> Mul<QuadExtField<Fq>> for &'a Fq2

Source§

type Output = QuadExtField<Fq>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Fq2) -> Fq2

Performs the * operation. Read more
Source§

impl Mul for Fq2

Source§

type Output = QuadExtField<Fq>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Fq2) -> Fq2

Performs the * operation. Read more
Source§

impl<'b> MulAssign<&'b QuadExtField<Fq>> for Fq2

Source§

fn mul_assign(&mut self, rhs: &'b Fq2)

Performs the *= operation. Read more
Source§

impl MulAssign for Fq2

Source§

fn mul_assign(&mut self, rhs: Fq2)

Performs the *= operation. Read more
Source§

impl<'a> Neg for &'a Fq2

Source§

type Output = QuadExtField<Fq>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Fq2

Performs the unary - operation. Read more
Source§

impl Neg for Fq2

Source§

type Output = QuadExtField<Fq>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Fq2

Performs the unary - operation. Read more
Source§

impl Ord for Fq2

Source§

fn cmp(&self, other: &Fq2) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialOrd for Fq2

Source§

fn partial_cmp(&self, other: &Fq2) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PrimeField for Fq2

Source§

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

A fixed multiplicative generator of modulus - 1 order. This element must also be a quadratic nonresidue. Read more
Source§

const NUM_BITS: u32 = 254u32

How many bits are needed to represent an element of this field.
Source§

const CAPACITY: u32 = 254u32

How many bits of information can be reliably stored in the field element. Read more
Source§

const S: u32 = 1u32

An integer s satisfying the equation 2^s * t = modulus - 1 with t odd. Read more
Source§

const ROOT_OF_UNITY: Self

The 2^s root of unity. Read more
Source§

const ROOT_OF_UNITY_INV: Self

Source§

const DELTA: Self

Generator of the t-order multiplicative subgroup. Read more
Source§

const TWO_INV: Self

Inverse of $2$ in the field.
Source§

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>

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

Converts an element of the prime field into the standard byte representation for this field. Read more
Source§

fn is_odd(&self) -> Choice

Returns true iff this element is odd.
Source§

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§

fn from_u128(v: u128) -> Self

Obtains a field element congruent to the integer v. Read more
Source§

fn from_repr_vartime(repr: Self::Repr) -> Option<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 is_even(&self) -> Choice

Returns true iff this element is even.
Source§

impl<T: Borrow<Fq2>> Product<T> for Fq2

Source§

fn product<I: Iterator<Item = T>>(iter: I) -> Self

Takes an iterator and generates Self from the elements by multiplying the items.
Source§

impl QuadExtFieldArith for Fq2

Source§

const SQRT: SQRT<Fq>

Source§

type Base = Fq

Source§

fn square_assign(el: &mut QuadExtField<Self::Base>)

Source§

fn mul_assign( lhs: &mut QuadExtField<Self::Base>, rhs: &QuadExtField<Self::Base>, )

Source§

impl SerdeObject for Fq2

Source§

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.
Source§

fn from_raw_bytes(bytes: &[u8]) -> Option<Self>

Source§

fn to_raw_bytes(&self) -> Vec<u8>

Source§

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.
Source§

fn read_raw<R: Read>(reader: &mut R) -> Result<Self>

Source§

fn write_raw<W: Write>(&self, writer: &mut W) -> Result<()>

Source§

impl<'a, 'b> Sub<&'b QuadExtField<Fq>> for &'a Fq2

Source§

type Output = QuadExtField<Fq>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &'b Fq2) -> Fq2

Performs the - operation. Read more
Source§

impl<'b> Sub<&'b QuadExtField<Fq>> for Fq2

Source§

type Output = QuadExtField<Fq>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &'b Fq2) -> Fq2

Performs the - operation. Read more
Source§

impl<'a> Sub<QuadExtField<Fq>> for &'a Fq2

Source§

type Output = QuadExtField<Fq>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Fq2) -> Fq2

Performs the - operation. Read more
Source§

impl Sub for Fq2

Source§

type Output = QuadExtField<Fq>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Fq2) -> Fq2

Performs the - operation. Read more
Source§

impl<'b> SubAssign<&'b QuadExtField<Fq>> for Fq2

Source§

fn sub_assign(&mut self, rhs: &'b Fq2)

Performs the -= operation. Read more
Source§

impl SubAssign for Fq2

Source§

fn sub_assign(&mut self, rhs: Fq2)

Performs the -= operation. Read more
Source§

impl<T: Borrow<Fq2>> Sum<T> for Fq2

Source§

fn sum<I: Iterator<Item = T>>(iter: I) -> Self

Takes an iterator and generates Self from the elements by “summing up” the items.
Source§

impl WithSmallOrderMulGroup<3> for Fq2

Source§

const ZETA: Self

A field element of small multiplicative order $N$. Read more
Source§

impl<F: Clone + Field> Clone for QuadExtField<F>

Source§

fn clone(&self) -> QuadExtField<F>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<F: Field> ConditionallySelectable for QuadExtField<F>

Source§

fn conditional_select(a: &Self, b: &Self, choice: Choice) -> Self

Select a or b according to choice. Read more
Source§

fn conditional_assign(&mut self, other: &Self, choice: Choice)

Conditionally assign other to self, according to choice. Read more
Source§

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 more
Source§

impl<F: Field> ConstantTimeEq for QuadExtField<F>

Source§

fn ct_eq(&self, other: &Self) -> Choice

Determine if two items are equal. Read more
Source§

fn ct_ne(&self, other: &Self) -> Choice

Determine if two items are NOT equal. Read more
Source§

impl<F: Debug + Field> Debug for QuadExtField<F>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<F: Default + Field> Default for QuadExtField<F>

Source§

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,

Source§

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>
where QuadExtField<F>: QuadExtFieldArith<Base = F> + ExtField,

Source§

const ZERO: Self

The zero element of the field, the additive identity.
Source§

const ONE: Self

The one element of the field, the multiplicative identity.
Source§

fn random(rng: impl RngCore) -> Self

Returns an element chosen uniformly at random using a user-provided RNG.
Source§

fn is_zero(&self) -> Choice

Returns true iff this element is zero.
Source§

fn square(&self) -> Self

Squares this element.
Source§

fn double(&self) -> Self

Doubles this element.
Source§

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)

Computes: Read more
Source§

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

Returns true iff this element is zero. Read more
Source§

fn cube(&self) -> Self

Cubes this element.
Source§

fn sqrt_alt(&self) -> (Choice, Self)

Equivalent to Self::sqrt_ratio(self, one()). Read more
Source§

fn pow<S>(&self, exp: S) -> Self
where S: AsRef<[u64]>,

Exponentiates self by exp, where exp is a little-endian order integer exponent. Read more
Source§

fn pow_vartime<S>(&self, exp: S) -> Self
where S: AsRef<[u64]>,

Exponentiates self by exp, where exp is a little-endian order integer exponent. Read more
Source§

impl<F: PartialEq + Field> PartialEq for QuadExtField<F>

Source§

fn eq(&self, other: &QuadExtField<F>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<F> Serialize for QuadExtField<F>
where F: Serialize + Field,

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<F: Copy + Field> Copy for QuadExtField<F>

Source§

impl<F: Eq + Field> Eq for QuadExtField<F>

Source§

impl<F: Field> StructuralPartialEq for QuadExtField<F>