public class ExtensionField extends java.lang.Object implements Field
| Modifier and Type | Field and Description |
|---|---|
protected FieldElement |
constant |
protected PolynomialRing.Polynomial |
definingPolynomial |
protected int |
extensionDegree |
protected ExtensionFieldElement[] |
frobeniusOfXPowers
frobeniusOfXPowers[i] = (x^p)^i mod (x^extensionDegree + constant)
for i <= extensionDegree
|
| Constructor and Description |
|---|
ExtensionField(java.math.BigInteger p)
Instantiates the prime order finite field Zp.
|
ExtensionField(FieldElement constant,
int extensionDegree)
Create extension defined by polynomial \(x^\text{extensionDegree} + \text{constant}\).
|
ExtensionField(Representation r) |
| Modifier and Type | Method and Description |
|---|---|
ExtensionFieldElement |
createElement(java.math.BigInteger b)
Map an integer b to an element in this field.
|
ExtensionFieldElement |
createElement(FieldElement... coefficients)
Create an element in this field, based on a given polynomial
representation of an element in the ideal of the quotient field.
|
ExtensionFieldElement |
createElement(java.util.List<java.math.BigInteger> coefficients) |
boolean |
equals(java.lang.Object obj) |
void |
generatePrimitiveCubeRoot()
Search and set primitive cube root in this field.
|
Field |
getBaseField() |
java.math.BigInteger |
getCharacteristic()
Returns the characteristic of the ring.
|
FieldElement |
getConstant() |
FieldElement |
getCubeRoot()
Returns fixed primitive cube root in this field.
|
PolynomialRing.Polynomial |
getDefiningPolynomial()
Returns the irreducible polynomial that this field is defined over.
|
ExtensionFieldElement |
getElement(java.math.BigInteger i)
Maps the integer i into this ring \(R\), such that this map is a
ring homomorphism \(\mathbb{Z}_{\text{getCharacteristic()}} \rightarrow R\).
|
ExtensionFieldElement |
getElement(long i)
Maps the integer i into this ring \(R\), such that this map is a
ring homomorphism \(\mathbb{Z}_{\text{getCharacteristic()}} \rightarrow R\).
|
int |
getExtensionDegree() |
ExtensionFieldElement |
getOneElement()
Returns the multiplicative neutral element of this ring.
|
FieldElement |
getPrimitiveElement()
If this is a finite field, returns a generator of the field's unit group.
|
Representation |
getRepresentation()
The representation of this object.
|
ExtensionFieldElement |
getUniformlyRandomElement()
Returns an element of this structure that is drawn uniformly at random
using a cryptographically strong RNG.
|
java.util.Optional<java.lang.Integer> |
getUniqueByteLength()
Returns the number of bytes returned by this structure's
UniqueByteRepresentable.getUniqueByteRepresentation(),
or an empty Optional if this structure's elements do not guarantee a fixed length. |
ExtensionFieldElement |
getZeroElement()
Returns the additive neutral element of this ring.
|
int |
hashCode() |
boolean |
isBaseField() |
FieldElement[] |
reduce(FieldElement[] coefficients) |
ExtensionFieldElement |
restoreElement(Representation repr)
Creates an element of this structure from its representation.
|
protected void |
setCubeRoot(FieldElement cubeRoot)
Set auxiliary primitive cube root in this field.
|
java.math.BigInteger |
size()
Returns the number of elements in this structure (the size).
|
java.math.BigInteger |
sizeUnitGroup()
Returns the number of units in this ring.
|
java.lang.String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitgetUniformlyRandomUnit, isCommutativeasAdditiveGroup, asUnitGroup, extendedEuclideanAlgorithm, extendedEuclideanAlgorithm, getUniformlyRandomElements, getUniformlyRandomNonzeroElement, getUniformlyRandomNonzeroElements, getUniformlyRandomUnits, restoreFromRepresentation, restoreVectorhasPrimeSizeprotected FieldElement constant
protected int extensionDegree
protected PolynomialRing.Polynomial definingPolynomial
protected ExtensionFieldElement[] frobeniusOfXPowers
public ExtensionField(FieldElement constant, int extensionDegree)
public ExtensionField(java.math.BigInteger p)
p - size of the field (must be prime)public ExtensionField(Representation r)
public FieldElement getConstant()
public boolean isBaseField()
public Representation getRepresentation()
RepresentableReprUtilgetRepresentation in interface RepresentableRepresentationpublic FieldElement getCubeRoot()
protected void setCubeRoot(FieldElement cubeRoot)
public void generatePrimitiveCubeRoot()
public FieldElement[] reduce(FieldElement[] coefficients)
public ExtensionFieldElement createElement(FieldElement... coefficients)
public ExtensionFieldElement getElement(java.math.BigInteger i)
RinggetElement in interface FieldgetElement in interface Ringi - the integer to mappublic ExtensionFieldElement getElement(long i)
RinggetElement in interface FieldgetElement in interface Ringi - the integer to mappublic ExtensionFieldElement createElement(java.math.BigInteger b)
Let this field L be a degree k extension of a field K given by \(L=K/(f(X))\). Let n be the size of K. This function computes the n-ary representation of b:
\(b=b_0 n^0 + b_1 n^1 + b_2 n^2 ... b_t n^t\)
Then, it maps \(b_i\) to \(c_i\) in K by recursively invoking K.createElement(b_i)
and constructs the polynomial
\(p(X) = c_0 X^0 + c_1 X^1 + c_2 X^t + ... + c_t X^t\). Then, it projects \(p(X)\) to \(K/(f(X))\) in the canonical way.
Hence, this mapping is injective on the integers smaller than this.size().
b - the integer to map to a field elementpublic java.lang.String toString()
toString in class java.lang.Objectpublic java.math.BigInteger sizeUnitGroup()
throws java.lang.UnsupportedOperationException
RingsizeUnitGroup in interface FieldsizeUnitGroup in interface Ringjava.lang.UnsupportedOperationException - if size is unknown or is computationally too expensive to computepublic Field getBaseField()
public java.math.BigInteger getCharacteristic()
throws java.lang.UnsupportedOperationException
Ring
The characteristic of a ring is defined to be the number n
such that there is a ring homomorphism from Zn to the ring.
getCharacteristic in interface Ringjava.lang.UnsupportedOperationException - if unknownpublic java.math.BigInteger size()
throws java.lang.UnsupportedOperationException
Structurepublic FieldElement getPrimitiveElement() throws java.lang.UnsupportedOperationException
FieldgetPrimitiveElement in interface Fieldjava.lang.UnsupportedOperationException - if operation is not feasible or undefinedpublic ExtensionFieldElement getZeroElement()
RinggetZeroElement in interface FieldgetZeroElement in interface Ringpublic ExtensionFieldElement getOneElement()
RinggetOneElement in interface FieldgetOneElement in interface Ringpublic ExtensionFieldElement restoreElement(Representation repr)
StructurerestoreElement in interface FieldrestoreElement in interface RingrestoreElement in interface Structurerepr - the Representation returned by Representable.getRepresentation()public ExtensionFieldElement createElement(java.util.List<java.math.BigInteger> coefficients)
public ExtensionFieldElement getUniformlyRandomElement() throws java.lang.UnsupportedOperationException
StructuregetUniformlyRandomElement in interface FieldgetUniformlyRandomElement in interface RinggetUniformlyRandomElement in interface Structurejava.lang.UnsupportedOperationException - if the operation is not supportedpublic PolynomialRing.Polynomial getDefiningPolynomial()
public int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int getExtensionDegree()
public java.util.Optional<java.lang.Integer> getUniqueByteLength()
StructureUniqueByteRepresentable.getUniqueByteRepresentation(),
or an empty Optional if this structure's elements do not guarantee a fixed length.
For example, elements of Zp will always be represented by ceil(ceil(log(p))/8) bytes,
hence getUniqueByteLength() would return ceil(ceil(log(p))/8).
A polynomial ring would return an empty Optional since a polynomial's unique byte representation length
depends on its degree.
getUniqueByteLength in interface StructuregetUniqueByteRepresentation(),
or an empty Optional, if no guarantee