|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--HFE.Poly2_nMax
This class encapsulates the operations for polynomials
over the finite field F_64 which is an extension over
F_4. The generation polynomial is f(x) = x^3 + x^2 + 2x + 3
The polynomials are bounded by maxLen
.
Field Summary | |
private static Field2_n |
aqlTmp
register for the use in applyQL. |
private static Field2_n |
aqlTmp2
register for the use in applyQL. |
private static Field2_n[] |
aqlVec
registers for the use in applyQL. |
(package private) static Poly2_nMax |
div_tmp
static variable for method div |
private static Poly2_nMax[] |
gcd_tmp
local variable for gcd algorithm. |
private static Field2_n |
gcd_tmpCoeff
local variable for gcd algorithm. |
(package private) static int |
maxLen
Maximal length of the polynomials |
(package private) static Field2_n |
mod_divRes
second static variable for our mod method |
(package private) static Field2_n |
mod_tmp
static variable for mod method |
(package private) static Poly2_nMax |
modS_additive
static variable for our mod method |
(package private) static Field2_n |
modS_tmp
second static variable for our mod method |
(package private) static Poly2_nMax |
modulus
Modulus for the mod version of the operations |
(package private) static Field2_n |
mul_tmp
Static register for multiplication |
(package private) Field2_n |
mulAdd_coeff
static variable for mulAdd |
(package private) static Field2_n[] |
squareMul_tmp
local variable for squareMod. |
(package private) static Field2_n |
squareMul_tmpCoeff
local variable for squareMod. |
(package private) Field2_n[] |
value
Current value of the polynomial. |
Constructor Summary | |
(package private) |
Poly2_nMax()
sets all the coefficients to zero and allocates new memory |
(package private) |
Poly2_nMax(Poly2_nMax father)
Creates a copy from the given polynomial |
(package private) |
Poly2_nMax(Poly2_nMax father,
int shift)
Takes one polynomial and shifts it by the given shift. |
(package private) |
Poly2_nMax(java.util.Random rnd)
Generates a polynomial with random coefficients. |
(package private) |
Poly2_nMax(java.util.Random rnd,
int degree)
Generates a polynomial with random coefficient. |
Method Summary | |
(package private) void |
add(Poly2_nMax whom)
calculate this += whom as polynomial addition |
(package private) void |
add(Poly2_nMax a,
Poly2_nMax b)
calculates this = wen1 + wen2 as polynomial addition |
(package private) void |
addOne()
calculate this += 1 as polynomial addition |
(package private) void |
allocMem()
Allocates new memory. |
(package private) Field2_n |
applyPoly(Field2_n num)
Uses the given polynomial as a function. |
(package private) void |
applyQL(Field2_n res,
Field2_n num)
res = P(num) Assumes that the polynomial has a special form, namely no constant term, and all other terms have a power of Hamming weight 2 at most. |
(package private) void |
copy(Poly2_nMax father)
Takes one polynomial and copies it. |
(package private) void |
copyShift(Poly2_nMax father,
int shift)
Takes one polynomial and shifts it by the given shift. |
(package private) int |
degree()
Returns the degree of the object. |
(package private) void |
div(Poly2_nMax a,
Poly2_nMax b)
Calculates this = a / b and assumes that there is _no_ remainder, i.e. |
(package private) void |
divS(Poly2_nMax a,
Poly2_nMax b)
Calculates this = a / b and assumes that there is _no_ remainder! Slow implementation, use div(HFE.Poly2_nMax, HFE.Poly2_nMax) instead! |
(package private) void |
gcd(Poly2_nMax a,
Poly2_nMax b)
Computes this = gcd(a,b) using an iterative gcd algorithm for polynomials. |
(package private) void |
getCoeff(Field2_n res,
int pos)
get coefficient at position pos by copying it to res |
(package private) Field2_n |
getCoeff(int pos)
get coefficient at position pos by constructing a new object from type Field2_n |
(package private) static void |
initAll()
Initializes the static variables |
(package private) boolean |
isEqual(Poly2_nMax whom)
Compares the current polynomial with the given one. |
(package private) boolean |
isZero()
Checks if a polynomial is the zero polynomial. |
static void |
main(java.lang.String[] args)
Mainly invoces the testIt() method. |
(package private) void |
mod()
Calculates this %= moduls. |
(package private) void |
mod(Poly2_nMax b)
Calculates this %= b |
(package private) void |
mod(Poly2_nMax a,
Poly2_nMax b)
Calculates this = a % b |
(package private) void |
modS(Poly2_nMax b)
Calculates this %= b slow but working implementation of mod |
(package private) void |
mul(Poly2_nMax a,
Poly2_nMax b)
calculates this = a * b as polynomial multiplication Assumes that a.degree + b.degree < maxLen |
(package private) void |
mulAdd(Field2_n coeff,
Poly2_nMax poly)
compute this = coeff*poly where coeff is from GF(2^n) and poly is an object of type Poly2_nMax |
(package private) void |
mulFactor(Field2_n factor)
multiplies all coefficients by the given factor in GF(2^n) uses static memory to store the result of each step |
(package private) void |
setCoeff(Field2_n whom,
int pos)
set coefficient at position pos _with_ copying it |
(package private) void |
setCoeff(java.util.Random rnd,
int pos)
set coefficient at position pos with a random value |
(package private) static void |
setModulus(Poly2_nMax newModulus)
Sets the private field modulus. |
(package private) void |
setZero()
Sets all the coefficients to zero without allocating new memory |
(package private) void |
shiftL(int shift)
Shifts the current polynomial by the given number of places. |
static void |
speedIt()
|
(package private) void |
squareMod(Poly2_nMax in,
Poly2_nMax modul,
int degree)
Calculates this = in^2 mod modul and used the fact that characteristic p=2 for GF(2^n) which means that squaring in GF(2^n) is cheaper than multiplication. |
(package private) java.lang.String |
stringIt()
transfer the polynomial to a string |
(package private) static void |
testIt()
Tests the functionality for the whole class. |
Methods inherited from class java.lang.Object |
|
Field Detail |
static final int maxLen
static Poly2_nMax modulus
Field2_n[] value
static Field2_n mul_tmp
static Poly2_nMax modS_additive
static Field2_n modS_tmp
static Field2_n mod_tmp
static Field2_n mod_divRes
static Poly2_nMax div_tmp
Field2_n mulAdd_coeff
static Field2_n[] squareMul_tmp
static Field2_n squareMul_tmpCoeff
private static Poly2_nMax[] gcd_tmp
private static Field2_n gcd_tmpCoeff
private static Field2_n aqlTmp
private static Field2_n aqlTmp2
private static Field2_n[] aqlVec
Constructor Detail |
Poly2_nMax()
Poly2_nMax(Poly2_nMax father)
father
- polynomial to be copiedPoly2_nMax(Poly2_nMax father, int shift)
father
- polynomial to be copiedshift
- the number of elements to be shifted.Poly2_nMax(java.util.Random rnd)
rnd
- Random sourcePoly2_nMax(java.util.Random rnd, int degree)
rnd
- Random sourcedegree
- degree of the resulting polynomialMethod Detail |
static void setModulus(Poly2_nMax newModulus)
int degree()
boolean isEqual(Poly2_nMax whom)
boolean isZero()
void setZero()
Field2_n getCoeff(int pos)
void getCoeff(Field2_n res, int pos)
void setCoeff(Field2_n whom, int pos)
void setCoeff(java.util.Random rnd, int pos)
void allocMem()
void copyShift(Poly2_nMax father, int shift)
father
- Polynomial to be copiedshift
- number of elements to be shifted.void shiftL(int shift)
shift
- number of places to be shiftedvoid copy(Poly2_nMax father)
void mulFactor(Field2_n factor)
void add(Poly2_nMax a, Poly2_nMax b)
void add(Poly2_nMax whom)
void addOne()
void mul(Poly2_nMax a, Poly2_nMax b)
void mod()
void mod(Poly2_nMax a, Poly2_nMax b)
void modS(Poly2_nMax b)
void mod(Poly2_nMax b)
void divS(Poly2_nMax a, Poly2_nMax b)
div(HFE.Poly2_nMax, HFE.Poly2_nMax)
instead!void div(Poly2_nMax a, Poly2_nMax b)
void mulAdd(Field2_n coeff, Poly2_nMax poly)
coeff
- coefficient from GF(2^n) which is multipliedpoly
- polynomial over GF(2^n) in xstatic void initAll()
void squareMod(Poly2_nMax in, Poly2_nMax modul, int degree)
in
- Polynomial to be squaredmodul
- Modul which is used for reductiondegree
- degree of the modul (only for the sake of speed)void gcd(Poly2_nMax a, Poly2_nMax b)
a
- Polynomialb
- PolynomialField2_n applyPoly(Field2_n num)
void applyQL(Field2_n res, Field2_n num)
java.lang.String stringIt()
static void testIt()
public static final void speedIt()
public static void main(java.lang.String[] args)
testIt()
method.
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |