Class GF2nElement
java.lang.Object
org.bouncycastle.pqc.legacy.math.linearalgebra.GF2nElement
- All Implemented Interfaces:
GFElement
- Direct Known Subclasses:
GF2nONBElement
,GF2nPolynomialElement
This abstract class implements an element of the finite field GF(2)n
in either optimal normal basis representation (ONB)
or in polynomial representation. It is extended by the classes GF2nONBElement and GF2nPolynomialElement .
- See Also:
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract Object
clone()
final GF2nElement
Performs a basis transformation of this element to the given GF2nField basis.final GF2nField
getField()
Returns the field of this element.abstract GF2nElement
increase()
Returns this element + 1.abstract void
Increases this element by one.abstract GF2nElement
Solves a quadratic equation.
Let z2 + z = this.abstract GF2nElement
square()
Returns this element to the power of 2.abstract GF2nElement
Compute the square root of this element and return the result in a newGF2nElement
.abstract void
Compute the square root of this element.abstract void
Squares this element.final GFElement
Compute the difference of this element and minuend.final void
subtractFromThis
(GFElement minuend) Compute the difference of this element and minuend, overwriting this element.abstract boolean
Returns whether the rightmost bit of the bit representation is set.abstract int
trace()
Returns the trace of this element.Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.bouncycastle.pqc.legacy.math.linearalgebra.GFElement
add, addToThis, equals, hashCode, invert, isOne, isZero, multiply, multiplyThisBy, toByteArray, toFlexiBigInt, toString, toString
-
Field Details
-
mField
holds a pointer to this element's corresponding field. -
mDegree
protected int mDegreeholds the extension degree n of this element's corresponding field.
-
-
Constructor Details
-
GF2nElement
public GF2nElement()
-
-
Method Details
-
clone
-
testRightmostBit
public abstract boolean testRightmostBit()Returns whether the rightmost bit of the bit representation is set. This is needed for data conversion according to 1363.- Returns:
- true if the rightmost bit of this element is set
-
getField
Returns the field of this element.- Returns:
- the field of this element
-
increase
Returns this element + 1.- Returns:
- this + 1
-
increaseThis
public abstract void increaseThis()Increases this element by one. -
subtract
Compute the difference of this element and minuend. -
subtractFromThis
Compute the difference of this element and minuend, overwriting this element.- Specified by:
subtractFromThis
in interfaceGFElement
- Parameters:
minuend
- the minuend
-
square
Returns this element to the power of 2.- Returns:
- this2
-
squareThis
public abstract void squareThis()Squares this element. -
squareRoot
Compute the square root of this element and return the result in a newGF2nElement
.- Returns:
- this1/2 (newly created)
-
squareRootThis
public abstract void squareRootThis()Compute the square root of this element. -
convert
Performs a basis transformation of this element to the given GF2nField basis.- Parameters:
basis
- the GF2nField representation to transform this element to- Returns:
- this element in the representation of basis
-
trace
public abstract int trace()Returns the trace of this element.- Returns:
- the trace of this element
-
solveQuadraticEquation
Solves a quadratic equation.
Let z2 + z = this. Then this method returns z.- Returns:
- z with z2 + z = this
- Throws:
RuntimeException
-