public class GF2mField
extends java.lang.Object
PolynomialRingGF2
Constructor and Description |
---|
GF2mField(byte[] enc) |
GF2mField(GF2mField field) |
GF2mField(int degree)
create a finite field GF(2^m)
|
GF2mField(int degree,
int poly)
create a finite field GF(2^m) with the fixed field polynomial
|
Modifier and Type | Method and Description |
---|---|
int |
add(int a,
int b)
Return sum of two elements
|
java.lang.String |
elementToStr(int a) |
boolean |
equals(java.lang.Object other)
checks if given object is equal to this field.
|
int |
exp(int a,
int k)
compute exponentiation a^k
|
int |
getDegree()
return degree of the field
|
byte[] |
getEncoded()
return the encoded form of this field
|
int |
getPolynomial()
return the field polynomial
|
int |
getRandomElement(java.security.SecureRandom sr)
create a random field element using PRNG sr
|
int |
getRandomNonZeroElement()
create a random non-zero field element
|
int |
getRandomNonZeroElement(java.security.SecureRandom sr)
create a random non-zero field element using PRNG sr
|
int |
hashCode() |
int |
inverse(int a)
compute the multiplicative inverse of a
|
boolean |
isElementOfThisField(int e) |
int |
mult(int a,
int b)
Return product of two elements
|
int |
sqRoot(int a)
compute the square root of an integer
|
java.lang.String |
toString()
Returns a human readable form of this field.
|
public GF2mField(int degree)
degree
- the degree of the fieldpublic GF2mField(int degree, int poly)
degree
- the degree of the fieldpoly
- the field polynomialpublic GF2mField(byte[] enc)
public GF2mField(GF2mField field)
public int getDegree()
public int getPolynomial()
public byte[] getEncoded()
public int add(int a, int b)
a
- b
- public int mult(int a, int b)
a
- b
- public int exp(int a, int k)
a
- a field element ak
- k degreepublic int inverse(int a)
a
- a field element apublic int sqRoot(int a)
a
- a field element apublic int getRandomElement(java.security.SecureRandom sr)
sr
- SecureRandompublic int getRandomNonZeroElement()
public int getRandomNonZeroElement(java.security.SecureRandom sr)
sr
- SecureRandompublic boolean isElementOfThisField(int e)
public java.lang.String elementToStr(int a)
public boolean equals(java.lang.Object other)
The method returns false whenever the given object is not GF2m.
equals
in class java.lang.Object
other
- objectpublic int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object