Package com.itextpdf.barcodes.qrcode
Class GF256
- java.lang.Object
-
- com.itextpdf.barcodes.qrcode.GF256
-
final class GF256 extends java.lang.ObjectThis 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
intfor convenience and speed (but at the cost of memory). Only the bottom 8 bits are really used.
-
-
Field Summary
Fields Modifier and Type Field Description static GF256DATA_MATRIX_FIELDprivate int[]expTableprivate int[]logTableprivate GF256Polyonestatic GF256QR_CODE_FIELDprivate GF256Polyzero
-
Constructor Summary
Constructors Modifier Constructor Description privateGF256(int primitive)Create a representation of GF(256) using the given primitive polynomial.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) static intaddOrSubtract(int a, int b)Implements both addition and subtraction -- they are the same in GF(256).(package private) GF256PolybuildMonomial(int degree, int coefficient)(package private) intexp(int a)(package private) GF256PolygetOne()(package private) GF256PolygetZero()(package private) intinverse(int a)(package private) intlog(int a)(package private) intmultiply(int a, int b)
-
-
-
Constructor Detail
-
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 Detail
-
getZero
GF256Poly getZero()
-
getOne
GF256Poly getOne()
-
buildMonomial
GF256Poly buildMonomial(int degree, int coefficient)
- 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)
-
-