Documentation ¶
Overview ¶
Package gf256 implements arithmetic over the Galois Field GF(256).
Index ¶
Constants ¶
const ReedSolomonGenerator = 0x02
ReedSolomonGenerator is the generator for the finit field for reed-solomon codes
const ReedSolomonPolynomial = 0x11d
ReedSolomonPolynomial is the polynomial commonly used for finite field construction for Reed-Solomon-Codes (100011101)
const RijndaelGenerator = 0x03
RijndaelGenerator is the generator for Rijndael's finite field
const RijndaelPolynomial = 0x11b
RijndaelPolynomial is the Rijndael-Polynomial for finite field construction (100011011)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Field ¶
type Field struct {
// contains filtered or unexported fields
}
A Field represents an instance of GF(256) defined by a specific polynomial.
func NewField ¶
NewField returns a new field corresponding to the polynomial poly and generator a. The Reed-Solomon encoding in QR codes uses polynomial 0x11d with generator 2.
The choice of generator a only affects the Exp and Log operations.
func (*Field) Inv ¶
Inv returns the multiplicative inverse of x in the field. If x == 0, Inv returns 0.
type RSEncoder ¶
type RSEncoder struct {
// contains filtered or unexported fields
}
An RSEncoder implements Reed-Solomon encoding over a given field using a given number of error correction bytes.
func NewRSEncoder ¶
NewRSEncoder returns a new Reed-Solomon encoder over the given field and number of error correction bytes.