public final class SexticOverQuadraticTowerExtensionField extends Object
This class also offers special methods to multiply sparsely populated
elements of the form v0 + v2 i^2 + v3 i^3
respectively v0
+ v3 i^3 + v4 i^4
. Furthermore, computation of powers in the
cyclotomic subgroup is implemented [3].
References:
[1] N. Benger, M. Scott. Constructing Tower Extensions of Finite Fields for Implementation of Pairing-Based Cryptography.
[2] A. Weimerskirch, C. Paar. Generalizations of the Karatsuba Algorithm for Efficient Implementations.
[3] R. Granger, M. Scott. Faster Squaring in the Cyclotomic Subgroup of Sixth Degree Extensions
public SexticExtensionFieldElement negate(GenericFieldElement a)
GenericField
a
, i.e. performs the operation b = -b
.a
- the field elementa
public SexticExtensionFieldElement negateOutOfPlace(GenericFieldElement a)
GenericField
a
, i.e. performs the operation b = -b
,
where a new object holding the result is created.a
- the field elementa
public SexticExtensionFieldElement add(GenericFieldElement a, GenericFieldElement b)
GenericField
b
to a
, i.e. performs the operation
a += b
.a
- the first addendb
- the second addenda
and b
public SexticExtensionFieldElement addOutOfPlace(PrimeCharacteristicFieldElement a, PrimeCharacteristicFieldElement b)
PrimeCharacteristicField
a
- first summandb
- second summandpublic SexticExtensionFieldElement subtract(GenericFieldElement a, GenericFieldElement b)
GenericField
b
from a
, i.e. performs the operation
a -= b
.a
- the minuendb
- the subtrahenda
and b
public SexticExtensionFieldElement subtractOutOfPlace(GenericFieldElement a, GenericFieldElement b)
PrimeCharacteristicField
b
from this
and returns a new object
holding the result.a
- the minuendb
- the subtrahenda
and b
public SexticExtensionFieldElement multiply(GenericFieldElement a, GenericFieldElement b)
GenericField
a
by b
, i.e. performs the operation
a *= b
.a
- the first factorb
- the second factora
and b
public SexticExtensionFieldElement multiplyOutOfPlace(GenericFieldElement a, GenericFieldElement b)
GenericField
a
by b
, i.e. performs the operation
a *= b
, where a new object holding the result is created.a
- the first factorb
- the second factora
and b
public SexticExtensionFieldElement multiply(GenericFieldElement a, BigInteger n)
GenericField
a
by n
, i.e. performs the operation
a *= n
.a
- the first factorn
- the second factora
and n
public SexticExtensionFieldElement multiplyOutOfPlace(GenericFieldElement a, BigInteger n)
GenericField
a
by n
, i.e. performs the operation
a *= n
, where a new object holding the result is created.a
- the first factorn
- the second factora
and n
public SexticExtensionFieldElement multiplyBy2(PrimeCharacteristicFieldElement a)
PrimeCharacteristicField
a
by 2
, which is a left-shift. Works in-place.a
- the element to be shifteda
holding the resultpublic SexticExtensionFieldElement multiplyBy2OutOfPlace(PrimeCharacteristicFieldElement a)
PrimeCharacteristicField
a
by 2
, which is a left-shift and
returns a new object holding the result.a
- the element to be shifteda
holding the resultpublic SexticExtensionFieldElement multiplyBy3(PrimeCharacteristicFieldElement a)
PrimeCharacteristicField
a
by 3
, which is a left-shift plus an
addition. Works in-place.a
- the element to multiplieda
holding the resultpublic SexticExtensionFieldElement multiplyBy3OutOfPlace(PrimeCharacteristicFieldElement a)
PrimeCharacteristicField
a
by 3
, which is a left-shift plus an
addition and returns a new object holding the result.a
- the element to multiplieda
holding the resultpublic SexticExtensionFieldElement multiplyByPowerOf2(PrimeCharacteristicFieldElement a, int exponent)
PrimeCharacteristicField
a
by a power of 2
, which is a
left-shift. Works in-place.a
- the element to be shiftedexponent
- the power of 2a
holding the resultpublic SexticExtensionFieldElement multiplyByPowerOf2OutOfPlace(PrimeCharacteristicFieldElement a, int exponent)
PrimeCharacteristicField
a
by a power of 2
, which is a
left-shift and returns a new object holding the result.a
- the element to be shiftedexponent
- the power of 2a
holding the resultpublic SexticExtensionFieldElement divide(GenericFieldElement a, GenericFieldElement b)
GenericField
a
by b
, i.e. performs the operation
a /= b
.a
- the dividendb
- the divisora
and b
public SexticExtensionFieldElement divideBy2(PrimeCharacteristicFieldElement a)
PrimeCharacteristicField
a
by 2.a
- the dividenda
and 2.public SexticExtensionFieldElement conjugate(ExtensionFieldElement b)
ExtensionField
b
- the element to be conjugatedb
public SexticExtensionFieldElement invert(GenericFieldElement a)
GenericField
a
, i.e. performs the operation
a = a^(-1)
.a
- the field elementa
public SexticExtensionFieldElement square(GenericFieldElement a)
GenericField
a
, i.e. performs the operation a *= a
.a
- the field elementa
public SexticExtensionFieldElement squareOutOfPlace(GenericFieldElement a)
GenericField
a
, i.e. performs the operation a*a
,
where a new object holding the result is created.a
- the field elementa
public SexticExtensionFieldElement squareRoot(ExtensionFieldElement a, boolean checkSquare)
UnsupportedOperationException
.a
- the field elementcheckSquare
- check if a
is a square. If true
, the
return value is undefined for non-squares.a
if it exists, null otherwisepublic SexticExtensionFieldElement squareRoot(ExtensionFieldElement a)
UnsupportedOperationException
.a
- the field elementa
if it exists, null otherwisepublic PrimeFieldElement getNorm(ExtensionFieldElement a)
ExtensionField
a
- the field elementa
public SexticExtensionFieldElement getOne()
GenericField
public SexticExtensionFieldElement getZero()
GenericField
public SexticExtensionFieldElement newElement(Object b)
ExtensionField
BigInteger
-array
representation. Every component in the canonical representation of the
field's elements corresponds to an array dimension, in ascending order.b
- the BigInteger[]
public SexticExtensionFieldElement newElement(PrimeCharacteristicFieldElement a, PrimeCharacteristicFieldElement b, PrimeCharacteristicFieldElement c, PrimeCharacteristicFieldElement d, PrimeCharacteristicFieldElement e, PrimeCharacteristicFieldElement f)
a
- the first elementb
- the second elementc
- the third elementd
- the fourth elemente
- the fifth elementf
- the sixth elementa,b,c,d,e,f
public SexticExtensionFieldElement newElement(byte[] bytes)
GenericField
byte
-array representation.bytes
- the byte[]
in little-endian orderpublic SexticExtensionFieldElement toElement(byte[] bytes)
GenericField
byte
-array. Unlike
GenericField.newElement(byte[])
, this method does not assume the
input to be a valid encoding of a field element.bytes
- a byte[]
in little-endian orderpublic SexticExtensionFieldElement getUniformlyRandomElement()
PrimeCharacteristicField
public SexticExtensionFieldElement getUniformlyRandomNonZeroElement()
PrimeCharacteristicField
public BigInteger[][] toBigIntegers(ExtensionFieldElement a)
ExtensionField
BigInteger
representation.a
- the field elementBigInteger
representationpublic SexticExtensionFieldElement newElementFromBaseField(PrimeFieldElement a)
ExtensionField
this
.a
- a prime field elementa
as element of this
public SexticExtensionFieldElement newElementFromSubField(PrimeCharacteristicFieldElement a)
ExtensionField
this
.a
- a sub field elementa
as element of this
public SexticExtensionFieldElement multiply(ExtensionFieldElement a, PrimeFieldElement b)
ExtensionField
a
- extension field elementb
- prime field elementa
multiplied by the adjoint root.public QuadraticExtensionFieldElement getNonResidue()
public int getQuadraticCharacter(PrimeCharacteristicFieldElement a)
UnsupportedOperationException
.a
- a field element(a/p)
public SexticExtensionFieldElement multiplyByAdjointRoot(ExtensionFieldElement a)
ExtensionField
a
by the root used to obtain the extension field.a
- extension field elementa
multiplied by the adjoint root.public SexticExtensionFieldElement multiplyDenseSparse023(SexticExtensionFieldElement a, ExtensionFieldElement b)
a
- first operandb
- second operand (sparse)a
and b
public SexticExtensionFieldElement multiplyDenseSparse023(SexticExtensionFieldElement a, PrimeCharacteristicFieldElement b_0, PrimeCharacteristicFieldElement b_2, PrimeCharacteristicFieldElement b_3)
a
- first operandb_0
- constant coefficient of second operandb_2
- coefficient of i^2 of second operandb_3
- coefficient of i^3 of second operanda
and b
public SexticExtensionFieldElement multiplySparse023(SexticExtensionFieldElement a, ExtensionFieldElement b)
a
- first operand (sparse)b
- second operand (sparse)a
and b
public SexticExtensionFieldElement multiplySparse023(SexticExtensionFieldElement a, PrimeCharacteristicFieldElement b_0, PrimeCharacteristicFieldElement b_2, PrimeCharacteristicFieldElement b_3)
a
- first operand (sparse)b_0
- constant coefficient of second operandb_2
- coefficient of i^2 of second operandb_3
- coefficient of i^3 of second operanda
and b
public SexticExtensionFieldElement multiplyDenseSparse034(SexticExtensionFieldElement a, ExtensionFieldElement b)
a
- first operandb
- second operand (sparse)a
and b
public SexticExtensionFieldElement multiplyDenseSparse034(SexticExtensionFieldElement a, PrimeCharacteristicFieldElement v0, PrimeCharacteristicFieldElement v3, PrimeCharacteristicFieldElement v4)
a
- first operandv0
- constant coefficient of second operandv3
- coefficient of i^3 of second operandv4
- coefficient of i^4 of second operanda
and b
public SexticExtensionFieldElement multiplySparse034(SexticExtensionFieldElement a, ExtensionFieldElement b)
a
- first operand (sparse)b
- second operand (sparse)a
and b
public SexticExtensionFieldElement multiplySparse034(SexticExtensionFieldElement a, PrimeCharacteristicFieldElement v0, PrimeCharacteristicFieldElement v3, PrimeCharacteristicFieldElement v4)
a
- first operand (sparse)v0
- constant coefficient of second operandv3
- coefficient of i^3 of second operandv4
- coefficient of i^4 of second operanda
and b
public SexticExtensionFieldElement conjugate(ExtensionFieldElement b, int i)
ExtensionField
i
times.b
- the element to be conjugatedi
- number of times the element should be conjugatedb
conjugated i
timespublic SexticExtensionFieldElement applyFrobenius(ExtensionFieldElement a, int i)
ExtensionField
i
-th Frobenius of a
.a
- the element on which the Frobenius map should be applied.i
- number of times the Frobenius map should be applied.i
times to a
.public FrobeniusSexticExtensionOverQuadraticConstants getFrobeniusConstants()
public SexticExtensionFieldElement squareUni(SexticExtensionFieldElement a)
a
- the cyclotomic subgroup elementa
squaredpublic SexticExtensionFieldElement exponentiateUni(SexticExtensionFieldElement a, BigInteger n)
a
- the cyclotomic subgroup elementn
- the exponenta
to the n
-th powerpublic GenericFieldElement[] invertElements(GenericFieldElement[] elements)
GenericField
invertElements
in interface GenericField
elements
- the array of field elementspublic ExtensionFieldElement exponentiate(GenericFieldElement a, BigInteger n)
GenericField
a
to the power n
, i.e. performs the
operation a = a^n
.exponentiate
in interface ExtensionField
exponentiate
in interface GenericField
exponentiate
in interface PrimeCharacteristicField
a
- the field elementn
- the exponentn
th power of
a
public ExtensionFieldElement exponentiate(GenericFieldElement a, int n)
GenericField
a
to the power n
, i.e. performs the
operation a = a^n
.exponentiate
in interface GenericField
a
- the field elementn
- the exponentn
th power of
a
public ExtensionFieldElement exponentiateByPowerOf2(GenericFieldElement a, int n)
GenericField
a
to the power 2n
.exponentiateByPowerOf2
in interface ExtensionField
exponentiateByPowerOf2
in interface GenericField
exponentiateByPowerOf2
in interface PrimeCharacteristicField
a
- the field elementn
- the exponentpublic BigInteger getCardinality()
GenericField
getCardinality
in interface GenericField
BigInteger
holding the cardinalitypublic FieldTypes getFieldType()
GenericField
getFieldType
in interface GenericField
public int getFieldSize()
getFieldSize
in interface ECField
public int getDepth()
ExtensionField
getDepth
in interface ExtensionField
public int getDegree()
ExtensionField
getDegree
in interface ExtensionField
this
over its subfield.public int getDegreeOverBaseField()
ExtensionField
getDegreeOverBaseField
in interface ExtensionField
this
over its base field.public AbstractPrimeField getBaseField()
GenericField
getBaseField
in interface ExtensionField
getBaseField
in interface GenericField
public ExtensionField getSubField()
ExtensionField
null
if the subfield equals the base field, and the
subfield otherwise.getSubField
in interface ExtensionField
null
if the subfield equals the base field, and the
subfield otherwise.public int hashCode()
hashCode
in interface GenericField
hashCode
in class Object
public boolean equals(Object obj)
equals
in interface GenericField
equals
in class Object
Copyright © 2011–2022 Stiftung SIC. All rights reserved.