|
Bouncy Castle Cryptography Library 1.79 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.bouncycastle.pqc.legacy.math.linearalgebra.GF2nElement | +--org.bouncycastle.pqc.legacy.math.linearalgebra.GF2nPolynomialElement
This class implements elements of finite binary fields GF(2 n) using polynomial representation. For more information on the arithmetic see for example IEEE Standard 1363 or Certicom online-tutorial.
GF2nPolynomialField
,
GF2nONBElement
,
GF2Polynomial
Fields inherited from class org.bouncycastle.pqc.legacy.math.linearalgebra.GF2nElement |
mDegree, mField |
Constructor Summary | |
GF2nPolynomialElement(GF2nPolynomialElement other)
Creates a new GF2nPolynomialElement by cloning the given GF2nPolynomialElement b. |
|
GF2nPolynomialElement(GF2nPolynomialField f,
byte[] os)
Creates a new GF2nPolynomialElement using the given field f and byte[] os as value. |
|
GF2nPolynomialElement(GF2nPolynomialField f,
GF2Polynomial bs)
Creates a new GF2nPolynomialElement using the given field and Bitstring. |
|
GF2nPolynomialElement(GF2nPolynomialField f,
int[] is)
Creates a new GF2nPolynomialElement using the given field f and int[] is as value. |
|
GF2nPolynomialElement(GF2nPolynomialField f,
java.util.Random rand)
Create a new random GF2nPolynomialElement using the given field and source of randomness. |
Method Summary | |
GFElement |
add(GFElement addend)
Compute the sum of this element and addend. |
void |
addToThis(GFElement addend)
Compute this + addend (overwrite this). |
java.lang.Object |
clone()
Creates a new GF2nPolynomialElement by cloning this GF2nPolynomialElement. |
boolean |
equals(java.lang.Object other)
Compare this element with another object. |
int |
hashCode()
|
GF2nElement |
increase()
Returns this element + 'one". |
void |
increaseThis()
Increases this element by 'one'. |
GFElement |
invert()
Compute the multiplicative inverse of this element. |
GF2nPolynomialElement |
invertEEA()
Calculates the multiplicative inverse of this and returns the result in a new GF2nPolynomialElement. |
GF2nPolynomialElement |
invertMAIA()
Calculates the multiplicative inverse of this using the modified almost inverse algorithm and returns the result in a new GF2nPolynomialElement. |
GF2nPolynomialElement |
invertSquare()
Calculates the multiplicative inverse of this and returns the result in a new GF2nPolynomialElement. |
boolean |
isOne()
Tests if the GF2nPolynomialElement has 'one' as value. |
boolean |
isZero()
Checks whether this element is zero. |
GFElement |
multiply(GFElement factor)
Compute the product of this element and factor. |
void |
multiplyThisBy(GFElement factor)
Compute this * factor (overwrite this). |
static GF2nPolynomialElement |
ONE(GF2nPolynomialField f)
Create the one element. |
GF2nPolynomialElement |
power(int k)
Calculates this to the power of k and returns the result in a new GF2nPolynomialElement. |
GF2nElement |
solveQuadraticEquation()
Solves the quadratic equation z 2 + z = this if such a solution exists. |
GF2nElement |
square()
This method is used internally to map the square()-calls within GF2nPolynomialElement to one of the possible squaring methods. |
GF2nPolynomialElement |
squareBitwise()
Squares this GF2nPolynomialElement by shifting left its Bitstring and reducing. |
GF2nPolynomialElement |
squareMatrix()
Squares this GF2nPolynomialElement using GF2nField's squaring matrix. |
GF2nPolynomialElement |
squarePreCalc()
Squares this GF2nPolynomialElement by using precalculated values and reducing. |
GF2nElement |
squareRoot()
Compute the square root of this element and return the result in a new GF2nPolynomialElement . |
void |
squareRootThis()
Compute the square root of this element. |
void |
squareThis()
This method is used internally to map the square()-calls within GF2nPolynomialElement to one of the possible squaring methods. |
void |
squareThisBitwise()
Squares this GF2nPolynomialElement by shifting left its Bitstring and reducing. |
void |
squareThisMatrix()
Squares this GF2nPolynomialElement using GF2nFields squaring matrix. |
void |
squareThisPreCalc()
Squares this GF2nPolynomialElement by using precalculated values and reducing. |
boolean |
testRightmostBit()
Returns whether the rightmost bit of the bit representation is set. |
byte[] |
toByteArray()
Converts this GF2nPolynomialElement to a byte[] according to 1363. |
java.math.BigInteger |
toFlexiBigInt()
Converts this GF2nPolynomialElement to an integer according to 1363. |
java.lang.String |
toString()
Returns a string representing this Bitstrings value using hexadecimal radix in MSB-first order. |
java.lang.String |
toString(int radix)
Returns a string representing this Bitstrings value using hexadecimal or binary radix in MSB-first order. |
int |
trace()
Returns the trace of this GF2nPolynomialElement. |
static GF2nPolynomialElement |
ZERO(GF2nPolynomialField f)
Create the zero element. |
Methods inherited from class org.bouncycastle.pqc.legacy.math.linearalgebra.GF2nElement |
convert, getField, subtract, subtractFromThis |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public GF2nPolynomialElement(GF2nPolynomialField f, java.util.Random rand)
f
- the GF2nField to userand
- the source of randomnesspublic GF2nPolynomialElement(GF2nPolynomialField f, GF2Polynomial bs)
f
- the GF2nPolynomialField to usebs
- the desired value as Bitstringpublic GF2nPolynomialElement(GF2nPolynomialField f, byte[] os)
f
- the GF2nField to useos
- the octet string to assign to this GF2nPolynomialElementpublic GF2nPolynomialElement(GF2nPolynomialField f, int[] is)
f
- the GF2nField to useis
- the integer string to assign to this GF2nPolynomialElementpublic GF2nPolynomialElement(GF2nPolynomialElement other)
other
- the GF2nPolynomialElement to cloneMethod Detail |
public java.lang.Object clone()
clone
in class GF2nElement
public static GF2nPolynomialElement ZERO(GF2nPolynomialField f)
f
- the finite fieldpublic static GF2nPolynomialElement ONE(GF2nPolynomialField f)
f
- the finite fieldpublic boolean isZero()
public boolean isOne()
public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
other
- the other objectpublic int hashCode()
hashCode
in class java.lang.Object
public boolean testRightmostBit()
testRightmostBit
in class GF2nElement
public GFElement add(GFElement addend) throws java.lang.RuntimeException
addend
- the addendpublic void addToThis(GFElement addend) throws java.lang.RuntimeException
addend
- the addendpublic GF2nElement increase()
increase
in class GF2nElement
public void increaseThis()
increaseThis
in class GF2nElement
public GFElement multiply(GFElement factor) throws java.lang.RuntimeException
factor
- the factorpublic void multiplyThisBy(GFElement factor) throws java.lang.RuntimeException
factor
- the factorpublic GFElement invert() throws java.lang.ArithmeticException
java.lang.ArithmeticException
- if this is the zero element.invertMAIA()
,
invertEEA()
,
invertSquare()
public GF2nPolynomialElement invertEEA() throws java.lang.ArithmeticException
java.lang.ArithmeticException
- if this equals zeropublic GF2nPolynomialElement invertSquare() throws java.lang.ArithmeticException
java.lang.ArithmeticException
- if this equals zeropublic GF2nPolynomialElement invertMAIA() throws java.lang.ArithmeticException
java.lang.ArithmeticException
- if this equals zeropublic GF2nElement square()
square
in class GF2nElement
squarePreCalc()
public void squareThis()
squareThis
in class GF2nElement
public GF2nPolynomialElement squareMatrix()
GF2Polynomial.vectorMult(org.bouncycastle.pqc.legacy.math.linearalgebra.GF2Polynomial)
,
squarePreCalc()
,
squareBitwise()
public void squareThisMatrix()
GF2Polynomial.vectorMult(org.bouncycastle.pqc.legacy.math.linearalgebra.GF2Polynomial)
,
squarePreCalc()
,
squareBitwise()
public GF2nPolynomialElement squareBitwise()
squareMatrix()
,
squarePreCalc()
,
GF2Polynomial.squareThisBitwise()
public void squareThisBitwise()
squareMatrix()
,
squarePreCalc()
,
GF2Polynomial.squareThisBitwise()
public GF2nPolynomialElement squarePreCalc()
squareMatrix()
,
GF2Polynomial.squareThisPreCalc()
public void squareThisPreCalc()
squareMatrix()
,
GF2Polynomial.squareThisPreCalc()
public GF2nPolynomialElement power(int k)
k
- the powerpublic GF2nElement squareRoot()
GF2nPolynomialElement
.squareRoot
in class GF2nElement
public void squareRootThis()
squareRootThis
in class GF2nElement
public GF2nElement solveQuadraticEquation() throws java.lang.RuntimeException
solveQuadraticEquation
in class GF2nElement
public int trace()
trace
in class GF2nElement
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toString(int radix)
radix
- the radix to use (2 or 16, otherwise 2 is used)public byte[] toByteArray()
public java.math.BigInteger toFlexiBigInt()
|
Bouncy Castle Cryptography Library 1.79 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |