org.bouncycastle.crypto.bls

## Class Fp6Element

- java.lang.Object
- - org.bouncycastle.crypto.bls.Fp6Element

-     public final class Fp6Element
      extends java.lang.Object

  Immutable element of `Fp^6 = Fp^2[v] / (v^3 - (1 + I))`, the cubic extension of `Fp2Element` used as the inner level of the BLS12-381 pairing field tower.

  An element is represented as `c0 + c1*v + c2*v^2` where each c_i is an Fp^2 element. Multiplication uses the relation `v^3 = NON_RESIDUE` where `NON_RESIDUE = 1 + I`, the standard BLS12-381 cubic non-residue choice.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static Fp6Element` | `ONE`
    `static Fp6Element` | `ZERO`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Fp6Element` | `add(Fp6Element other)`
    `Fp2Element` | `c0()`
    `Fp2Element` | `c1()`
    `Fp2Element` | `c2()`
    `boolean` | `equals(java.lang.Object other)`
    `Fp6Element` | `frobenius()` Frobenius: raise to the `p` power.
    `Fp6Element` | `frobeniusSquared()` Frobenius²: raise to the `p^2` power.
    `static Fp6Element` | `fromFp2(Fp2Element c0)`
    `int` | `hashCode()`
    `Fp6Element` | `inverse()` Inverse via the standard cubic-extension formula: t0 = c0^2 - xi*c1*c2 t1 = xi*c2^2 - c0*c1 t2 = c1^2 - c0*c2 norm = c0*t0 + xi*c2*t1 + xi*c1*t2 inv = (t0 + t1*v + t2*v^2) / norm
    `boolean` | `isZero()`
    `Fp6Element` | `modPow(java.math.BigInteger exponent)` Modular exponentiation by a non-negative integer.
    `Fp6Element` | `mul(Fp6Element other)` Schoolbook multiplication using `v^3 = NON_RESIDUE`: (a0 + a1*v + a2*v^2) * (b0 + b1*v + b2*v^2) = (a0*b0 + (a1*b2 + a2*b1)*xi) + (a0*b1 + a1*b0 + a2*b2*xi) * v + (a0*b2 + a1*b1 + a2*b0) * v^2 where xi = NON_RESIDUE.
    `Fp6Element` | `mulByV()` Multiplies an element of Fp^6 by `v`, the polynomial generator.
    `Fp6Element` | `mulFp2(Fp2Element s)` Multiplies by an Fp^2 scalar.
    `Fp6Element` | `neg()`
    `static Fp6Element` | `of(Fp2Element c0, Fp2Element c1, Fp2Element c2)`
    `Fp6Element` | `square()` Squaring via the Chung-Hasan SQR3 algorithm: 6 Fp^2 multiplications versus 9 for the schoolbook product.
    `Fp6Element` | `sub(Fp6Element other)`
    `java.lang.String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### ZERO

          public static final Fp6Element ZERO

    - #### ONE

          public static final Fp6Element ONE

  - ### Method Detail

    - #### of

          public static Fp6Element of(Fp2Element c0,
                                      Fp2Element c1,
                                      Fp2Element c2)

    - #### fromFp2

          public static Fp6Element fromFp2(Fp2Element c0)

    - #### c0

          public Fp2Element c0()

    - #### c1

          public Fp2Element c1()

    - #### c2

          public Fp2Element c2()

    - #### isZero

          public boolean isZero()

    - #### add

          public Fp6Element add(Fp6Element other)

    - #### sub

          public Fp6Element sub(Fp6Element other)

    - #### neg

          public Fp6Element neg()

    - #### mul

          public Fp6Element mul(Fp6Element other)

      Schoolbook multiplication using `v^3 = NON_RESIDUE`:

             (a0 + a1*v + a2*v^2) * (b0 + b1*v + b2*v^2)
             = (a0*b0 + (a1*b2 + a2*b1)*xi)
             + (a0*b1 + a1*b0 + a2*b2*xi) * v
             + (a0*b2 + a1*b1 + a2*b0) * v^2

      where xi = NON_RESIDUE.

    - #### square

          public Fp6Element square()

      Squaring via the Chung-Hasan SQR3 algorithm: 6 Fp^2 multiplications versus 9 for the schoolbook product.

    - #### mulByV

          public Fp6Element mulByV()

      Multiplies an element of Fp^6 by `v`, the polynomial generator. Useful for the Fp^12 multiplication formula.

    - #### mulFp2

          public Fp6Element mulFp2(Fp2Element s)

      Multiplies by an Fp^2 scalar.

    - #### inverse

          public Fp6Element inverse()

      Inverse via the standard cubic-extension formula:

             t0 = c0^2 - xi*c1*c2
             t1 = xi*c2^2 - c0*c1
             t2 = c1^2 - c0*c2
             norm = c0*t0 + xi*c2*t1 + xi*c1*t2
             inv = (t0 + t1*v + t2*v^2) / norm

    - #### frobeniusSquared

          public Fp6Element frobeniusSquared()

      Frobenius²: raise to the `p^2` power. Identity on Fp² components (Frobenius² in Fp² is identity), with the `v`-basis components scaled by precomputed Fp² constants.

    - #### frobenius

          public Fp6Element frobenius()

      Frobenius: raise to the `p` power. The Fp² components are conjugated (Fp² Frobenius is conjugation since p ≡ 3 mod 4), then the v-basis components are scaled by precomputed coefficients.

    - #### modPow

          public Fp6Element modPow(java.math.BigInteger exponent)

      Modular exponentiation by a non-negative integer.

    - #### equals

          public boolean equals(java.lang.Object other)

      Overrides:
        `equals` in class `java.lang.Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `java.lang.Object`

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`