Top Description Fields Constructors Methods
org.bouncycastle.pqc.legacy.math.linearalgebra

public abstract Class GF2nElement

extends Object
implements GFElement
Class Inheritance
All Implemented Interfaces
org.bouncycastle.pqc.legacy.math.linearalgebra.GFElement
Known Direct Subclasses
org.bouncycastle.pqc.legacy.math.linearalgebra.GF2nONBElement, org.bouncycastle.pqc.legacy.math.linearalgebra.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
GF2nPolynomialElement, GF2nONBElement, GF2nONBField

Field Summary

Modifier and TypeField and Description
protected int
mDegree

holds the extension degree n of this element's corresponding field.

protected GF2nField
mField

holds a pointer to this element's corresponding field.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
pack-priv abstract void
assignOne()

Assigns the value 1 to this element.

pack-priv abstract void
assignZero()

Assign the value 0 to this element.

public abstract Object

Returns:

a copy of this GF2nElement
clone
()

Redeclares org.bouncycastle.pqc.legacy.math.linearalgebra.GFElement.clone.

Overrides java.lang.Object.clone.

Creates and returns a copy of this object.

public final GF2nElement

Returns:

this element in the representation of basis
convert
(GF2nField
the GF2nField representation to transform this element to
basis
)

Performs a basis transformation of this element to the given GF2nField basis.

public final GF2nField

Returns:

the field of this element
getField
()

Returns the field of this element.

public abstract GF2nElement

Returns:

this + 1
increase
()

Returns this element + 1.

public abstract void
increaseThis()

Increases this element by one.

public abstract GF2nElement

Returns:

z with z2 + z = this
solveQuadraticEquation
()

Solves a quadratic equation.

public abstract GF2nElement

Returns:

this2
square
()

Returns this element to the power of 2.

public abstract GF2nElement

Returns:

this1/2 (newly created)
squareRoot
()

Compute the square root of this element and return the result in a new GF2nElement.

public abstract void
squareRootThis()

Compute the square root of this element.

public abstract void
squareThis()

Squares this element.

public final GFElement

Returns:

this - minuend (newly created)
subtract
(GFElement
the minuend
minuend
)

Implements org.bouncycastle.pqc.legacy.math.linearalgebra.GFElement.subtract.

Compute the difference of this element and minuend.

public final void
subtractFromThis(GFElement
the minuend
minuend
)

Implements org.bouncycastle.pqc.legacy.math.linearalgebra.GFElement.subtractFromThis.

Compute the difference of this element and minuend, overwriting this element.

pack-priv abstract boolean

Returns:

true if the indexed bit is set
testBit
(int
the index of the bit to test
index
)

Checks whether the indexed bit of the bit representation is set

public abstract boolean

Returns:

true if the rightmost bit of this element is set
testRightmostBit
()

Returns whether the rightmost bit of the bit representation is set.

public abstract int

Returns:

the trace of this element
trace
()

Returns the trace of this element.

Inherited from java.lang.Object:
equalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

mDegreeback to summary
protected int mDegree

holds the extension degree n of this element's corresponding field.

mFieldback to summary
protected GF2nField mField

holds a pointer to this element's corresponding field.

Constructor Detail

GF2nElementback to summary
public GF2nElement()

Method Detail

assignOneback to summary
pack-priv abstract void assignOne()

Assigns the value 1 to this element.

assignZeroback to summary
pack-priv abstract void assignZero()

Assign the value 0 to this element.

cloneback to summary
public abstract Object clone()

Redeclares org.bouncycastle.pqc.legacy.math.linearalgebra.GFElement.clone.

Overrides java.lang.Object.clone.

Doc from java.lang.Object.clone.

Creates and returns a copy of this object. The precise meaning of "copy" may depend on the class of the object. The general intent is that, for any object x, the expression:

x.clone() != x
will be true, and that the expression:
x.clone().getClass() == x.getClass()
will be true, but these are not absolute requirements. While it is typically the case that:
x.clone().equals(x)
will be true, this is not an absolute requirement.

By convention, the returned object should be obtained by calling super.clone. If a class and all of its superclasses (except Object) obey this convention, it will be the case that x.clone().getClass() == x.getClass().

By convention, the object returned by this method should be independent of this object (which is being cloned). To achieve this independence, it may be necessary to modify one or more fields of the object returned by super.clone before returning it. Typically, this means copying any mutable objects that comprise the internal "deep structure" of the object being cloned and replacing the references to these objects with references to the copies. If a class contains only primitive fields or references to immutable objects, then it is usually the case that no fields in the object returned by super.clone need to be modified.

Returns:Object

a copy of this GF2nElement

convertback to summary
public final GF2nElement convert(GF2nField basis)

Performs a basis transformation of this element to the given GF2nField basis.

Parameters
basis:GF2nField

the GF2nField representation to transform this element to

Returns:GF2nElement

this element in the representation of basis

getFieldback to summary
public final GF2nField getField()

Returns the field of this element.

Returns:GF2nField

the field of this element

increaseback to summary
public abstract GF2nElement increase()

Returns this element + 1.

Returns:GF2nElement

this + 1

increaseThisback to summary
public abstract void increaseThis()

Increases this element by one.

solveQuadraticEquationback to summary
public abstract GF2nElement solveQuadraticEquation() throws RuntimeException

Solves a quadratic equation.
Let z2 + z = this. Then this method returns z.

Returns:GF2nElement

z with z2 + z = this

squareback to summary
public abstract GF2nElement square()

Returns this element to the power of 2.

Returns:GF2nElement

this2

squareRootback to summary
public abstract GF2nElement squareRoot()

Compute the square root of this element and return the result in a new GF2nElement.

Returns:GF2nElement

this1/2 (newly created)

squareRootThisback to summary
public abstract void squareRootThis()

Compute the square root of this element.

squareThisback to summary
public abstract void squareThis()

Squares this element.

subtractback to summary
public final GFElement subtract(GFElement minuend)

Implements org.bouncycastle.pqc.legacy.math.linearalgebra.GFElement.subtract.

Compute the difference of this element and minuend.

Parameters
minuend:GFElement

the minuend

Returns:GFElement

this - minuend (newly created)

subtractFromThisback to summary
public final void subtractFromThis(GFElement minuend)

Implements org.bouncycastle.pqc.legacy.math.linearalgebra.GFElement.subtractFromThis.

Compute the difference of this element and minuend, overwriting this element.

Parameters
minuend:GFElement

the minuend

testBitback to summary
pack-priv abstract boolean testBit(int index)

Checks whether the indexed bit of the bit representation is set

Parameters
index:int

the index of the bit to test

Returns:boolean

true if the indexed bit is set

testRightmostBitback to summary
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:boolean

true if the rightmost bit of this element is set

traceback to summary
public abstract int trace()

Returns the trace of this element.

Returns:int

the trace of this element