|
Bouncy Castle Cryptography 1.50 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.bouncycastle.pqc.math.linearalgebra.GF2nPolynomial
public class GF2nPolynomial
This class implements polynomials over GF2nElements.
GF2nElement| Constructor Summary | |
|---|---|
GF2nPolynomial(GF2nPolynomial a)
Creates a new PolynomialGF2n by cloning the given PolynomialGF2n a. |
|
GF2nPolynomial(GF2Polynomial polynomial,
GF2nField B1)
Creates a new PolynomialGF2n from the given Bitstring polynomial over the GF2nField B1. |
|
GF2nPolynomial(int deg,
GF2nElement elem)
Creates a new PolynomialGF2n of size deg and elem as coefficients. |
|
| Method Summary | |
|---|---|
GF2nPolynomial |
add(GF2nPolynomial b)
Adds the PolynomialGF2n b to this and returns the result in a new PolynomialGF2n. |
void |
assignZeroToElements()
|
GF2nElement |
at(int index)
Returns the coefficient at index. |
GF2nPolynomial[] |
divide(GF2nPolynomial b)
Divides this by b and stores the result in a new PolynomialGF2n[2], quotient in result[0] and remainder in result[1]. |
void |
enlarge(int k)
Enlarges the size of this PolynomialGF2n to k + 1. |
boolean |
equals(java.lang.Object other)
|
GF2nPolynomial |
gcd(GF2nPolynomial g)
Computes the greatest common divisor of this and g and returns the result in a new PolynomialGF2n. |
int |
getDegree()
Returns the degree of this PolynomialGF2n. |
int |
hashCode()
|
boolean |
isZero()
Returns true if all coefficients equal zero. |
GF2nPolynomial |
multiply(GF2nPolynomial b)
Multiplies this by b and returns the result in a new PolynomialGF2n. |
GF2nPolynomial |
multiplyAndReduce(GF2nPolynomial b,
GF2nPolynomial g)
Multiplies this by b, reduces the result by g and returns it in a new PolynomialGF2n. |
GF2nPolynomial |
quotient(GF2nPolynomial b)
Divides this by b and stores the quotient in a new PolynomialGF2n. |
GF2nPolynomial |
reduce(GF2nPolynomial g)
Reduces this by g and returns the result in a new PolynomialGF2n. |
GF2nPolynomial |
remainder(GF2nPolynomial b)
Divides this by b and stores the remainder in a new PolynomialGF2n. |
GF2nPolynomial |
scalarMultiply(GF2nElement s)
Multiplies the scalar s to each coefficient of this PolynomialGF2n and returns the result in a new PolynomialGF2n. |
void |
set(int index,
GF2nElement elem)
Sets the coefficient at index to elem. |
GF2nPolynomial |
shiftLeft(int amount)
|
void |
shiftThisLeft(int amount)
Shifts left this by amount and stores the result in this PolynomialGF2n. |
void |
shrink()
|
int |
size()
Returns the size (=maximum degree + 1) of this PolynomialGF2n. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public GF2nPolynomial(int deg,
GF2nElement elem)
deg - -
the maximum degree + 1elem - -
a GF2nElementpublic GF2nPolynomial(GF2nPolynomial a)
a - the PolynomialGF2n to clone
public GF2nPolynomial(GF2Polynomial polynomial,
GF2nField B1)
polynomial - the Bitstring to useB1 - the field| Method Detail |
|---|
public final void assignZeroToElements()
public final int size()
public final int getDegree()
public final void enlarge(int k)
k - the new maximum degreepublic final void shrink()
public final void set(int index,
GF2nElement elem)
index - the indexelem - the GF2nElement to store as coefficient indexpublic final GF2nElement at(int index)
index - the index
public final boolean isZero()
public final boolean equals(java.lang.Object other)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Object
public final GF2nPolynomial add(GF2nPolynomial b)
throws java.lang.RuntimeException
b - -
the PolynomialGF2n to add
DifferentFieldsException - if this and b are not defined over
the same field.
java.lang.RuntimeException
public final GF2nPolynomial scalarMultiply(GF2nElement s)
throws java.lang.RuntimeException
s - the scalar to multiply
DifferentFieldsException - if this and s are not defined over
the same field.
java.lang.RuntimeException
public final GF2nPolynomial multiply(GF2nPolynomial b)
throws java.lang.RuntimeException
b - the PolynomialGF2n to multiply
DifferentFieldsException - if this and b are not defined over
the same field.
java.lang.RuntimeException
public final GF2nPolynomial multiplyAndReduce(GF2nPolynomial b,
GF2nPolynomial g)
throws java.lang.RuntimeException,
java.lang.ArithmeticException
b - the PolynomialGF2n to multiplyg - the modul
DifferentFieldsException - if this, b and g are
not all defined over the same field.
java.lang.RuntimeException
java.lang.ArithmeticException
public final GF2nPolynomial reduce(GF2nPolynomial g)
throws java.lang.RuntimeException,
java.lang.ArithmeticException
g - -
the modulus
DifferentFieldsException - if this and g are not defined over
the same field.
java.lang.RuntimeException
java.lang.ArithmeticExceptionpublic final void shiftThisLeft(int amount)
amount - the amount to shift the coefficientspublic final GF2nPolynomial shiftLeft(int amount)
public final GF2nPolynomial[] divide(GF2nPolynomial b)
throws java.lang.RuntimeException,
java.lang.ArithmeticException
b - the divisor
DifferentFieldsException - if this and b are not defined over
the same field.
java.lang.RuntimeException
java.lang.ArithmeticException
public final GF2nPolynomial remainder(GF2nPolynomial b)
throws java.lang.RuntimeException,
java.lang.ArithmeticException
b - the divisor
DifferentFieldsException - if this and b are not defined over
the same field.
java.lang.RuntimeException
java.lang.ArithmeticException
public final GF2nPolynomial quotient(GF2nPolynomial b)
throws java.lang.RuntimeException,
java.lang.ArithmeticException
b - the divisor
DifferentFieldsException - if this and b are not defined over
the same field.
java.lang.RuntimeException
java.lang.ArithmeticException
public final GF2nPolynomial gcd(GF2nPolynomial g)
throws java.lang.RuntimeException,
java.lang.ArithmeticException
g - -
a GF2nPolynomial
DifferentFieldsException - if the coefficients of this and g use
different fields
java.lang.ArithmeticException - if coefficients are zero.
java.lang.RuntimeException
|
Bouncy Castle Cryptography 1.50 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||