|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--HFE.Field4
This class encapsulates the operations for a finite field
with 4 elements. The current field is generated by the
polynomial f(x) = x^2 + x + 1
Most operations are performed using a look-up table,
add and sub are using xor for integers.
Field Summary | |
private static int[][] |
divTab
look-up table for multiplication |
static int |
elements
number of elements in this field |
private static int[][] |
mulTab
look-up table for multiplication |
Constructor Summary | |
(package private) |
Field4()
|
Method Summary | |
static int |
add(int ter1,
int ter2)
Adds two numbers using the xor function for intergers. |
static int |
div(int whom,
int by)
Divides two numbers using finite field arithmetic in F_4. |
static boolean |
isElement(int elem)
Checks if a given integer is within the range of a Field4 element. |
static boolean |
isElement(int[] elems)
Checks if a given vector consists only of Field4 elements. |
static boolean |
isElement(int[][] elems)
Checks if a given matrix consists only of Field4 elements. |
static void |
main(java.lang.String[] args)
Tests everything in this class |
static int |
mul(int fac1,
int fac2)
Multiplies two numbers using finite field arithmetic in F_4. |
static int |
rnd(java.util.Random rnd)
returns a random element from Field4. |
static int |
sub(int ter1,
int ter2)
Subtracts two numbers using the xor function for intergers. |
static void |
testIt()
Tests the functionality of the whole class. |
Methods inherited from class java.lang.Object |
|
Field Detail |
public static final int elements
private static final int[][] mulTab
private static final int[][] divTab
Constructor Detail |
Field4()
Method Detail |
public static boolean isElement(int elem)
public static boolean isElement(int[] elems)
public static boolean isElement(int[][] elems)
public static final int add(int ter1, int ter2)
ter1
- element of F_4ter2
- element of F_4public static final int sub(int ter1, int ter2)
ter1
- element of F_4ter2
- element of F_4public static final int mul(int fac1, int fac2)
fac1
- element of F_4fac2
- element of F_4public static final int div(int whom, int by)
whom
- which number should be divisedby
- which number dividespublic static final int rnd(java.util.Random rnd)
public static final void testIt()
public static void main(java.lang.String[] args)
testIt()
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |