Package com.itextpdf.barcodes.qrcode
Class GF256
java.lang.Object
com.itextpdf.barcodes.qrcode.GF256
This class contains utility methods for performing mathematical operations over
the Galois Field GF(256). Operations use a given primitive polynomial in calculations.
Throughout this package, elements of GF(256) are represented as an int
for convenience and speed (but at the cost of memory).
Only the bottom 8 bits are really used.
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
GF256
(int primitive) Create a representation of GF(256) using the given primitive polynomial. -
Method Summary
Modifier and TypeMethodDescription(package private) static int
addOrSubtract
(int a, int b) Implements both addition and subtraction -- they are the same in GF(256).(package private) GF256Poly
buildMonomial
(int degree, int coefficient) (package private) int
exp
(int a) (package private) GF256Poly
getOne()
(package private) GF256Poly
getZero()
(package private) int
inverse
(int a) (package private) int
log
(int a) (package private) int
multiply
(int a, int b)
-
Field Details
-
QR_CODE_FIELD
-
DATA_MATRIX_FIELD
-
expTable
private final int[] expTable -
logTable
private final int[] logTable -
zero
-
one
-
-
Constructor Details
-
GF256
private GF256(int primitive) Create a representation of GF(256) using the given primitive polynomial.- Parameters:
primitive
- irreducible polynomial whose coefficients are represented by the bits of an int, where the least-significant bit represents the constant coefficient
-
-
Method Details
-
getZero
GF256Poly getZero() -
getOne
GF256Poly getOne() -
buildMonomial
- Returns:
- the monomial representing coefficient * x^degree
-
addOrSubtract
static int addOrSubtract(int a, int b) Implements both addition and subtraction -- they are the same in GF(256).- Returns:
- sum/difference of a and b
-
exp
int exp(int a) - Returns:
- 2 to the power of a in GF(256)
-
log
int log(int a) - Returns:
- base 2 log of a in GF(256)
-
inverse
int inverse(int a) - Returns:
- multiplicative inverse of a
-
multiply
int multiply(int a, int b) - Parameters:
a
-b
-- Returns:
- product of a and b in GF(256)
-