Class PolynomialRingGF2
- java.lang.Object
 - 
- org.bouncycastle.pqc.math.linearalgebra.PolynomialRingGF2
 
 
- 
public final class PolynomialRingGF2 extends java.lang.ObjectThis class describes operations with polynomials over finite field GF(2), i e polynomial ring R = GF(2)[X]. All operations are defined only for polynomials with degree <=32. For the polynomial representation the map f: R->Z, poly(X)->poly(2) is used, where integers have the binary representation. For example: X^7+X^3+X+1 -> (00...0010001011)=139 Also for polynomials type Integer is used.- See Also:
 GF2mField
 
- 
- 
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static intadd(int p, int q)Return sum of two polyomialsstatic intdegree(int p)Return the degree of a polynomialstatic intdegree(long p)Return the degree of a polynomialstatic intgcd(int p, int q)Return the greatest common divisor of two polynomialsstatic intgetIrreduciblePolynomial(int deg)Creates irreducible polynomial with degree dstatic booleanisIrreducible(int p)Checking polynomial for irreducibilitystatic intmodMultiply(int a, int b, int r)Compute the product of two polynomials modulo a third polynomial.static longmultiply(int p, int q)Return product of two polynomialsstatic intremainder(int p, int q)Return the remainder of a polynomial division of two polynomials.static intrest(long p, int q)Return the rest of devision two polynomials 
 - 
 
- 
- 
Method Detail
- 
add
public static int add(int p, int q)Return sum of two polyomials- Parameters:
 p- polynomialq- polynomial- Returns:
 - p+q
 
 
- 
multiply
public static long multiply(int p, int q)Return product of two polynomials- Parameters:
 p- polynomialq- polynomial- Returns:
 - p*q
 
 
- 
modMultiply
public static int modMultiply(int a, int b, int r)Compute the product of two polynomials modulo a third polynomial.- Parameters:
 a- the first polynomialb- the second polynomialr- the reduction polynomial- Returns:
 - a * b mod r
 
 
- 
degree
public static int degree(int p)
Return the degree of a polynomial- Parameters:
 p- polynomial p- Returns:
 - degree(p)
 
 
- 
degree
public static int degree(long p)
Return the degree of a polynomial- Parameters:
 p- polynomial p- Returns:
 - degree(p)
 
 
- 
remainder
public static int remainder(int p, int q)Return the remainder of a polynomial division of two polynomials.- Parameters:
 p- dividendq- divisor- Returns:
 - p mod q
 
 
- 
rest
public static int rest(long p, int q)Return the rest of devision two polynomials- Parameters:
 p- polinomialq- polinomial- Returns:
 - p mod q
 
 
- 
gcd
public static int gcd(int p, int q)Return the greatest common divisor of two polynomials- Parameters:
 p- polinomialq- polinomial- Returns:
 - GCD(p, q)
 
 
- 
isIrreducible
public static boolean isIrreducible(int p)
Checking polynomial for irreducibility- Parameters:
 p- polinomial- Returns:
 - true if p is irreducible and false otherwise
 
 
- 
getIrreduciblePolynomial
public static int getIrreduciblePolynomial(int deg)
Creates irreducible polynomial with degree d- Parameters:
 deg- polynomial degree- Returns:
 - irreducible polynomial p
 
 
 - 
 
 -