# py_ecc.fields package

## Submodules

## py_ecc.fields.field_elements module

class py_ecc.fields.field_elements.FQ(val: int | FQ)

  Bases: `object`

  A class for field elements in FQ. Wrap a number in this class, and it becomes a field element.

  field_modulus: int
  n: int
  classmethod one() → T_FQ
  classmethod zero() → T_FQ

class py_ecc.fields.field_elements.FQ12(coeffs: Sequence[int | FQ])

  Bases: `FQP`

  The 12th-degree extension field

  FQ12_MODULUS_COEFFS: FQ12_modulus_coeffs_type
  degree: int = 12

class py_ecc.fields.field_elements.FQ2(coeffs: Sequence[int | FQ])

  Bases: `FQP`

  The quadratic extension field

  FQ2_MODULUS_COEFFS: FQ2_modulus_coeffs_type
  degree: int = 2

class py_ecc.fields.field_elements.FQP(coeffs: Sequence[int | FQ], modulus_coeffs: Sequence[int | FQ] = ())

  Bases: `object`

  A class for elements in polynomial extension fields

  degree: int = 0
  field_modulus: int
  inv() → T_FQP
  classmethod one() → T_FQP
  classmethod zero() → T_FQP

## py_ecc.fields.field_properties module

class py_ecc.fields.field_properties.Curve_Field_Properties

  Bases: `TypedDict`

  field_modulus: int
  fq12_modulus_coeffs: FQ12_modulus_coeffs_type
  fq2_modulus_coeffs: FQ2_modulus_coeffs_type

## py_ecc.fields.optimized_field_elements module

class py_ecc.fields.optimized_field_elements.FQ(val: int | FQ)

  Bases: `object`

  A class for field elements in FQ. Wrap a number in this class, and it becomes a field element.

  field_modulus: int
  n: int
  classmethod one() → T_FQ
  property sgn0: int

    Calculates the sign of a value. sgn0(x) = 1 when x is ‘negative’; otherwise, sg0(x) = 0

    Note this is an optimized variant for m = 1

    Defined here: https://tools.ietf.org/html/draft-irtf-cfrg-hash-to-curve-09#section-4.1

  classmethod zero() → T_FQ

class py_ecc.fields.optimized_field_elements.FQ12(coeffs: Sequence[int | FQ])

  Bases: `FQP`

  The 12th-degree extension field

  FQ12_MODULUS_COEFFS: FQ12_modulus_coeffs_type
  degree: int = 12

class py_ecc.fields.optimized_field_elements.FQ2(coeffs: Sequence[int | FQ])

  Bases: `FQP`

  The quadratic extension field

  FQ2_MODULUS_COEFFS: FQ2_modulus_coeffs_type
  degree: int = 2
  property sgn0: int

    Calculates the sign of a value. sgn0(x) = 1 when x is ‘negative’; otherwise, sg0(x) = 0

    Note this is an optimized variant for m = 2

    Defined here: https://tools.ietf.org/html/draft-irtf-cfrg-hash-to-curve-09#section-4.1

class py_ecc.fields.optimized_field_elements.FQP(coeffs: Sequence[int | FQ], modulus_coeffs: Sequence[int | FQ] = ())

  Bases: `object`

  A class for elements in polynomial extension fields

  degree: int = 0
  field_modulus: int
  inv() → T_FQP
  mc_tuples: List[Tuple[int, int]]
  classmethod one() → T_FQP
  optimized_poly_rounded_div(a: Sequence[int | FQ], b: Sequence[int | FQ]) → Sequence[int | FQ]
  property sgn0: int

    Calculates the sign of a value. sgn0(x) = 1 when x is ‘negative’; otherwise, sg0(x) = 0

    Defined here: https://tools.ietf.org/html/draft-irtf-cfrg-hash-to-curve-09#section-4.1

  classmethod zero() → T_FQP

py_ecc.fields.optimized_field_elements.mod_int(x: int | FQ, n: int) → int

## Module contents

class py_ecc.fields.bls12_381_FQ(val: int | FQ)

  Bases: `FQ`

  field_modulus: int = 4002409555221667393417789825735904156556882819939007885332058136124031650490837864442687629129015664037894272559787

class py_ecc.fields.bls12_381_FQ12(coeffs: Sequence[int | FQ])

  Bases: `FQ12`, `bls12_381_FQP`

  FQ12_MODULUS_COEFFS: FQ12_modulus_coeffs_type = (2, 0, 0, 0, 0, 0, -2, 0, 0, 0, 0, 0)
  field_modulus: int = 4002409555221667393417789825735904156556882819939007885332058136124031650490837864442687629129015664037894272559787

class py_ecc.fields.bls12_381_FQ2(coeffs: Sequence[int | FQ])

  Bases: `FQ2`, `bls12_381_FQP`

  FQ2_MODULUS_COEFFS: FQ2_modulus_coeffs_type = (1, 0)
  field_modulus: int = 4002409555221667393417789825735904156556882819939007885332058136124031650490837864442687629129015664037894272559787

class py_ecc.fields.bls12_381_FQP(coeffs: Sequence[int | FQ], modulus_coeffs: Sequence[int | FQ] = ())

  Bases: `FQP`

  field_modulus: int = 4002409555221667393417789825735904156556882819939007885332058136124031650490837864442687629129015664037894272559787

class py_ecc.fields.bn128_FQ(val: int | FQ)

  Bases: `FQ`

  field_modulus: int = 21888242871839275222246405745257275088696311157297823662689037894645226208583

class py_ecc.fields.bn128_FQ12(coeffs: Sequence[int | FQ])

  Bases: `FQ12`, `bn128_FQP`

  FQ12_MODULUS_COEFFS: FQ12_modulus_coeffs_type = (82, 0, 0, 0, 0, 0, -18, 0, 0, 0, 0, 0)
  field_modulus: int = 21888242871839275222246405745257275088696311157297823662689037894645226208583

class py_ecc.fields.bn128_FQ2(coeffs: Sequence[int | FQ])

  Bases: `FQ2`, `bn128_FQP`

  FQ2_MODULUS_COEFFS: FQ2_modulus_coeffs_type = (1, 0)
  field_modulus: int = 21888242871839275222246405745257275088696311157297823662689037894645226208583

class py_ecc.fields.bn128_FQP(coeffs: Sequence[int | FQ], modulus_coeffs: Sequence[int | FQ] = ())

  Bases: `FQP`

  field_modulus: int = 21888242871839275222246405745257275088696311157297823662689037894645226208583

class py_ecc.fields.optimized_bls12_381_FQ(val: int | FQ)

  Bases: `FQ`

  field_modulus: int = 4002409555221667393417789825735904156556882819939007885332058136124031650490837864442687629129015664037894272559787

class py_ecc.fields.optimized_bls12_381_FQ12(coeffs: Sequence[int | FQ])

  Bases: `FQ12`, `optimized_bls12_381_FQP`

  FQ12_MODULUS_COEFFS: FQ12_modulus_coeffs_type = (2, 0, 0, 0, 0, 0, -2, 0, 0, 0, 0, 0)
  field_modulus: int = 4002409555221667393417789825735904156556882819939007885332058136124031650490837864442687629129015664037894272559787

class py_ecc.fields.optimized_bls12_381_FQ2(coeffs: Sequence[int | FQ])

  Bases: `FQ2`, `optimized_bls12_381_FQP`

  FQ2_MODULUS_COEFFS: FQ2_modulus_coeffs_type = (1, 0)
  field_modulus: int = 4002409555221667393417789825735904156556882819939007885332058136124031650490837864442687629129015664037894272559787

class py_ecc.fields.optimized_bls12_381_FQP(coeffs: Sequence[int | FQ], modulus_coeffs: Sequence[int | FQ] = ())

  Bases: `FQP`

  field_modulus: int = 4002409555221667393417789825735904156556882819939007885332058136124031650490837864442687629129015664037894272559787

class py_ecc.fields.optimized_bn128_FQ(val: int | FQ)

  Bases: `FQ`

  field_modulus: int = 21888242871839275222246405745257275088696311157297823662689037894645226208583

class py_ecc.fields.optimized_bn128_FQ12(coeffs: Sequence[int | FQ])

  Bases: `FQ12`, `optimized_bn128_FQP`

  FQ12_MODULUS_COEFFS: FQ12_modulus_coeffs_type = (82, 0, 0, 0, 0, 0, -18, 0, 0, 0, 0, 0)
  field_modulus: int = 21888242871839275222246405745257275088696311157297823662689037894645226208583

class py_ecc.fields.optimized_bn128_FQ2(coeffs: Sequence[int | FQ])

  Bases: `FQ2`, `optimized_bn128_FQP`

  FQ2_MODULUS_COEFFS: FQ2_modulus_coeffs_type = (1, 0)
  field_modulus: int = 21888242871839275222246405745257275088696311157297823662689037894645226208583

class py_ecc.fields.optimized_bn128_FQP(coeffs: Sequence[int | FQ], modulus_coeffs: Sequence[int | FQ] = ())

  Bases: `FQP`

  field_modulus: int = 21888242871839275222246405745257275088696311157297823662689037894645226208583