public final class QuadraticExtensionField extends Object
[1] Multiplication and squaring in pairing friendly fields.
[2] G. Adj, F. Rodrigues-Henriquez. Square root computation over even extension fields.
public int getQuadraticCharacter(PrimeCharacteristicFieldElement e)
ais a quadratic non-residue, a multiple of the modulus, or a
quadratic residue.e - a field elementepublic QuadraticExtensionFieldElement multiply(ExtensionFieldElement a, PrimeFieldElement b)
ExtensionFieldmultiply in interface ExtensionFielda - extension field elementb - prime field elementa multiplied by the adjoint root.public QuadraticExtensionFieldElement multiplyOutOfPlace(ExtensionFieldElement a, PrimeFieldElement b)
public QuadraticExtensionFieldElement multiply(GenericFieldElement a, GenericFieldElement b)
GenericFielda by b, i.e. performs the operation
a *= b.multiply in interface ExtensionFieldmultiply in interface GenericFieldmultiply in interface PrimeCharacteristicFielda - the first factorb - the second factora and bpublic QuadraticExtensionFieldElement multiplyOutOfPlace(GenericFieldElement a, GenericFieldElement b)
GenericFielda by b, i.e. performs the operation
a *= b, where a new object holding the result is created.multiplyOutOfPlace in interface GenericFielda - the first factorb - the second factora and bpublic QuadraticExtensionFieldElement multiply(GenericFieldElement a, BigInteger n)
GenericFielda by n, i.e. performs the operation
a *= n.multiply in interface ExtensionFieldmultiply in interface GenericFieldmultiply in interface PrimeCharacteristicFielda - the first factorn - the second factora and npublic QuadraticExtensionFieldElement multiplyOutOfPlace(GenericFieldElement a, BigInteger n)
GenericFielda by n, i.e. performs the operation
a *= n, where a new object holding the result is created.multiplyOutOfPlace in interface GenericFielda - the first factorn - the second factora and npublic QuadraticExtensionFieldElement square(GenericFieldElement a)
GenericFielda, i.e. performs the operation a *= a.square in interface ExtensionFieldsquare in interface GenericFieldsquare in interface PrimeCharacteristicFielda - the field elementapublic QuadraticExtensionFieldElement squareOutOfPlace(GenericFieldElement a)
GenericFielda, i.e. performs the operation a*a,
where a new object holding the result is created.squareOutOfPlace in interface GenericFielda - the field elementapublic QuadraticExtensionFieldElement squareRoot(ExtensionFieldElement a)
ExtensionFieldsquareRoot in interface ExtensionFielda - the field elementa if it exists, null otherwisepublic QuadraticExtensionFieldElement squareRoot(ExtensionFieldElement a, boolean checkSquare)
ExtensionFieldsquareRoot in interface ExtensionFielda - 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 QuadraticExtensionFieldElement multiplyBy2(PrimeCharacteristicFieldElement a)
PrimeCharacteristicFielda by 2, which is a left-shift. Works in-place.multiplyBy2 in interface PrimeCharacteristicFielda - the element to be shifteda holding the resultpublic QuadraticExtensionFieldElement multiplyBy2OutOfPlace(PrimeCharacteristicFieldElement a)
PrimeCharacteristicFielda by 2, which is a left-shift and
returns a new object holding the result.multiplyBy2OutOfPlace in interface PrimeCharacteristicFielda - the element to be shifteda holding the resultpublic QuadraticExtensionFieldElement multiplyBy3(PrimeCharacteristicFieldElement a)
PrimeCharacteristicFielda by 3, which is a left-shift plus an
addition. Works in-place.multiplyBy3 in interface PrimeCharacteristicFielda - the element to multiplieda holding the resultpublic QuadraticExtensionFieldElement multiplyBy3OutOfPlace(PrimeCharacteristicFieldElement a)
PrimeCharacteristicFielda by 3, which is a left-shift plus an
addition and returns a new object holding the result.multiplyBy3OutOfPlace in interface PrimeCharacteristicFielda - the element to multiplieda holding the resultpublic QuadraticExtensionFieldElement multiplyByPowerOf2(PrimeCharacteristicFieldElement a, int exponent)
PrimeCharacteristicFielda by a power of 2, which is a
left-shift. Works in-place.multiplyByPowerOf2 in interface PrimeCharacteristicFielda - the element to be shiftedexponent - the power of 2a holding the resultpublic QuadraticExtensionFieldElement multiplyByPowerOf2OutOfPlace(PrimeCharacteristicFieldElement a, int exponent)
PrimeCharacteristicFielda by a power of 2, which is a
left-shift and returns a new object holding the result.multiplyByPowerOf2OutOfPlace in interface PrimeCharacteristicFielda - the element to be shiftedexponent - the power of 2a holding the resultpublic QuadraticExtensionFieldElement invert(GenericFieldElement a)
GenericFielda, i.e. performs the operation
a = a^(-1).invert in interface ExtensionFieldinvert in interface GenericFieldinvert in interface PrimeCharacteristicFielda - the field elementapublic PrimeFieldElement getNorm(ExtensionFieldElement a)
ExtensionFielda - the field elementapublic QuadraticExtensionFieldElement newElement(Object b)
ExtensionFieldBigInteger-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 QuadraticExtensionFieldElement newElement(byte[] bytes)
GenericFieldbyte-array representation.bytes - the byte[] in little-endian orderpublic QuadraticExtensionFieldElement newElement(PrimeFieldElement a, PrimeFieldElement b)
a - a prime field elementb - a prime field elementa + i bpublic QuadraticExtensionFieldElement toElement(byte[] bytes)
GenericFieldbyte-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 QuadraticExtensionFieldElement getUniformlyRandomElement()
PrimeCharacteristicFieldpublic QuadraticExtensionFieldElement getUniformlyRandomNonZeroElement()
PrimeCharacteristicFieldpublic BigInteger[] toBigIntegers(ExtensionFieldElement a)
ExtensionFieldBigInteger
representation.a - the field elementBigInteger representationpublic QuadraticExtensionFieldElement newElementFromBaseField(PrimeFieldElement a)
ExtensionFieldthis.a - a prime field elementa as element of thispublic QuadraticExtensionFieldElement newElementFromSubField(PrimeCharacteristicFieldElement a)
ExtensionFieldthis.a - a sub field elementa as element of thispublic QuadraticExtensionFieldElement multiplyByAdjointRoot(ExtensionFieldElement a)
ExtensionFielda by the root used to obtain the extension field.multiplyByAdjointRoot in interface ExtensionFielda - extension field elementa multiplied by the adjoint root.public QuadraticExtensionFieldElement multiplyByAdjointRootOutOfPlace(ExtensionFieldElement a)
public QuadraticExtensionFieldElement applyFrobenius(ExtensionFieldElement a, int i)
ExtensionFieldi-th Frobenius of a.applyFrobenius in interface ExtensionFielda - 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 QuadraticExtensionFieldElement negate(GenericFieldElement a)
GenericFielda, i.e. performs the operation b = -b.a - the field elementapublic QuadraticExtensionFieldElement negateOutOfPlace(GenericFieldElement a)
GenericFielda, i.e. performs the operation b = -b,
where a new object holding the result is created.a - the field elementapublic QuadraticExtensionFieldElement add(GenericFieldElement a, GenericFieldElement b)
GenericFieldb to a, i.e. performs the operation
a += b.a - the first addendb - the second addenda and bpublic QuadraticExtensionFieldElement addOutOfPlace(PrimeCharacteristicFieldElement a, PrimeCharacteristicFieldElement b)
PrimeCharacteristicFielda - first summandb - second summandpublic QuadraticExtensionFieldElement subtract(GenericFieldElement a, GenericFieldElement b)
GenericFieldb from a, i.e. performs the operation
a -= b.a - the minuendb - the subtrahenda and bpublic QuadraticExtensionFieldElement subtractOutOfPlace(GenericFieldElement a, GenericFieldElement b)
PrimeCharacteristicFieldb from this and returns a new object
holding the result.a - the minuendb - the subtrahenda and bpublic QuadraticExtensionFieldElement divide(GenericFieldElement a, GenericFieldElement b)
GenericFielda by b, i.e. performs the operation
a /= b.a - the dividendb - the divisora and bpublic QuadraticExtensionFieldElement divideBy2(PrimeCharacteristicFieldElement a)
PrimeCharacteristicFielda by 2.a - the dividenda and 2.public QuadraticExtensionFieldElement conjugate(ExtensionFieldElement b)
ExtensionFieldb - the element to be conjugatedbpublic QuadraticExtensionFieldElement conjugate(ExtensionFieldElement b, int i)
ExtensionFieldi times.b - the element to be conjugatedi - number of times the element should be conjugatedb conjugated i timespublic QuadraticExtensionFieldElement getOne()
GenericFieldpublic QuadraticExtensionFieldElement getZero()
GenericFieldpublic GenericFieldElement getNonResidue()
public GenericFieldElement[] invertElements(GenericFieldElement[] elements)
GenericFieldinvertElements in interface GenericFieldelements - the array of field elementspublic ExtensionFieldElement exponentiate(GenericFieldElement a, BigInteger n)
GenericFielda to the power n, i.e. performs the
operation a = a^n.exponentiate in interface ExtensionFieldexponentiate in interface GenericFieldexponentiate in interface PrimeCharacteristicFielda - the field elementn - the exponentnth power of
apublic ExtensionFieldElement exponentiate(GenericFieldElement a, int n)
GenericFielda to the power n, i.e. performs the
operation a = a^n.exponentiate in interface GenericFielda - the field elementn - the exponentnth power of
apublic ExtensionFieldElement exponentiateByPowerOf2(GenericFieldElement a, int n)
GenericFielda to the power 2n.exponentiateByPowerOf2 in interface ExtensionFieldexponentiateByPowerOf2 in interface GenericFieldexponentiateByPowerOf2 in interface PrimeCharacteristicFielda - the field elementn - the exponentpublic BigInteger getCardinality()
GenericFieldgetCardinality in interface GenericFieldBigInteger holding the cardinalitypublic FieldTypes getFieldType()
GenericFieldgetFieldType in interface GenericFieldpublic int getFieldSize()
getFieldSize in interface ECFieldpublic int getDepth()
ExtensionFieldgetDepth in interface ExtensionFieldpublic int getDegree()
ExtensionFieldgetDegree in interface ExtensionFieldthis over its subfield.public int getDegreeOverBaseField()
ExtensionFieldgetDegreeOverBaseField in interface ExtensionFieldthis over its base field.public AbstractPrimeField getBaseField()
GenericFieldgetBaseField in interface ExtensionFieldgetBaseField in interface GenericFieldpublic ExtensionField getSubField()
ExtensionFieldnull if the subfield equals the base field, and the
subfield otherwise.getSubField in interface ExtensionFieldnull if the subfield equals the base field, and the
subfield otherwise.public int hashCode()
hashCode in interface GenericFieldhashCode in class Objectpublic boolean equals(Object obj)
equals in interface GenericFieldequals in class ObjectCopyright © 2011–2022 Stiftung SIC. All rights reserved.