Package org.bouncycastle.crypto.bls
Class Fp12Element
- java.lang.Object
-
- org.bouncycastle.crypto.bls.Fp12Element
-
public final class Fp12Element extends java.lang.ObjectImmutable element ofFp^12 = Fp^6[w] / (w^2 - v), the outer level of the BLS12-381 pairing field tower.An element is represented as
c0 + c1*wwhere each c_i is an Fp^6 element. The relationw^2 = v(the polynomial generator of Fp^6) gives a clean Karatsuba-style multiplication.
-
-
Field Summary
Fields Modifier and Type Field Description static Fp12ElementONEstatic Fp12ElementZERO
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Fp12Elementadd(Fp12Element other)Fp6Elementc0()Fp6Elementc1()Fp12Elementconjugate()Conjugate: (c0 + c1*w) → (c0 - c1*w).booleanequals(java.lang.Object other)Fp12Elementfrobenius()Frobenius: raise to theppower.Fp12ElementfrobeniusSquared()Frobenius²: raise to thep^2power.static Fp12ElementfromFp6(Fp6Element c0)inthashCode()Fp12Elementinverse()Modular inverse:booleanisZero()Fp12ElementmodPow(java.math.BigInteger exponent)Modular exponentiation by an integer exponent.Fp12Elementmul(Fp12Element other)Karatsuba multiplication usingw^2 = v:Fp12Elementneg()static Fp12Elementof(Fp6Element c0, Fp6Element c1)Fp12Elementsquare()Squaring via complex-style: (a0 + a1*w)^2 = (a0+a1)(a0+a1*v) - a0*a1 - a0*a1*v + 2*a0*a1*w.Fp12Elementsub(Fp12Element other)java.lang.StringtoString()
-
-
-
Field Detail
-
ZERO
public static final Fp12Element ZERO
-
ONE
public static final Fp12Element ONE
-
-
Method Detail
-
of
public static Fp12Element of(Fp6Element c0, Fp6Element c1)
-
fromFp6
public static Fp12Element fromFp6(Fp6Element c0)
-
c0
public Fp6Element c0()
-
c1
public Fp6Element c1()
-
isZero
public boolean isZero()
-
add
public Fp12Element add(Fp12Element other)
-
sub
public Fp12Element sub(Fp12Element other)
-
neg
public Fp12Element neg()
-
mul
public Fp12Element mul(Fp12Element other)
Karatsuba multiplication usingw^2 = v:(a0 + a1*w)(b0 + b1*w) = (a0*b0 + a1*b1*v) + ((a0+a1)(b0+b1) - a0*b0 - a1*b1) * w
-
square
public Fp12Element square()
Squaring via complex-style: (a0 + a1*w)^2 = (a0+a1)(a0+a1*v) - a0*a1 - a0*a1*v + 2*a0*a1*w. Three Fp^6 multiplications versus four for the Karatsuba product.
-
frobeniusSquared
public Fp12Element frobeniusSquared()
Frobenius²: raise to thep^2power. CombinesFp6Element.frobeniusSquared()on each Fp&sup6; component with a multiplication by the precomputed Fp² coefficient for thewbasis on the c1 component.
-
frobenius
public Fp12Element frobenius()
Frobenius: raise to theppower. CombinesFp6Element.frobenius()on each Fp&sup6; component with a multiplication by the precomputed Fp² coefficient for thewbasis on the c1 component.
-
conjugate
public Fp12Element conjugate()
Conjugate: (c0 + c1*w) → (c0 - c1*w). For BLS12-381 this equals the Fp^12 Frobenius applied 6 times (i.e. raising to the p^6 power), since the cyclotomic structure makes p^6-Frobenius act as conjugation.
-
inverse
public Fp12Element inverse()
Modular inverse:(c0 + c1*w)^-1 = (c0 - c1*w) / (c0^2 - c1^2 * v)
-
modPow
public Fp12Element modPow(java.math.BigInteger exponent)
Modular exponentiation by an integer exponent. Uses right-to-left square-and-multiply on the bit representation ofexponent; a negative exponent is handled by inverting and recursing on the absolute value.
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-