ReedSolomon

Reed-Solomon error correction over GF(2^n)

Namespace: Com\Tecnick\Barcode\Type

class ReedSolomon

Source: src/Type/ReedSolomon.php:34

Reed-Solomon error correction over GF(2^n)

Constants

GF_QRCODE

Primitive polynomial of the GF(256) of QR Code and Micro QR Code: x^8 + x^4 + x^3 + x^2 + 1. The word size 8 entry of GF is the Aztec one, over a different polynomial, so this field is named on its own.

public const GF_QRCODE = 285

Source: src/Type/ReedSolomon.php:57

Methods

__construct()

Initialize the Reed-Solomon Error Correction.

public __construct(int $wsize, int $primitive = 0, int $firstroot = 1)

Parameters:

  • $wsize (int): Size of a word in bits.
  • $primitive (int): Primitive polynomial of the Galois field, or zero for the one the word size selects in GF.
  • $firstroot (int): Exponent of the first root of the generator polynomial, which is the product of x + a^i over the roots. Aztec, Australia Post and Mailmark count from 1, QR Code and Micro QR Code from 0.

Source: src/Type/ReedSolomon.php:117

checkwords()

Returns the Reed-Solomon Error Correction Codewords for the input data.

public checkwords(int[] $data, int $necc): list<int>

Parameters:

  • $data (int[]): Array of data codewords to process.
  • $necc (int): Number of error correction bytes.

Returns: list<int>: Array of $necc error correction codewords.

Source: src/Type/ReedSolomon.php:131