halo2curves::bn256

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.

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 = Fq2::ZERO

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

const ROOT_OF_UNITY_INV: Self = Fq2::ZERO

Source§

const DELTA: Self = Fq2::ZERO

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