Supriya Ghosh (Editor)

BCH code

Updated on
Edit
Like
Comment
Share on FacebookTweet on TwitterShare on LinkedInShare on Reddit

In coding theory, the BCH codes form a class of cyclic error-correcting codes that are constructed using finite fields. BCH codes were invented in 1959 by French mathematician Alexis Hocquenghem, and independently in 1960 by Raj Bose and D. K. Ray-Chaudhuri. The acronym BCH comprises the initials of these inventors' surnames (mistakenly, in the case of Ray-Chaudhuri).

Contents

One of the key features of BCH codes is that during code design, there is a precise control over the number of symbol errors correctable by the code. In particular, it is possible to design binary BCH codes that can correct multiple bit errors. Another advantage of BCH codes is the ease with which they can be decoded, namely, via an algebraic method known as syndrome decoding. This simplifies the design of the decoder for these codes, using small low-power electronic hardware.

BCH codes are used in applications such as satellite communications, compact disc players, DVDs, disk drives, solid-state drives and two-dimensional bar codes.

Primitive narrow-sense BCH codes

Given a prime power q and positive integers m and d with dqm − 1, a primitive narrow-sense BCH code over the finite field GF(q) with code length n = qm − 1 and distance at least d is constructed by the following method.

Let α be a primitive element of GF(qm). For any positive integer i, let mi(x) be the minimal polynomial of αi over GF(q). The generator polynomial of the BCH code is defined as the least common multiple g(x) = lcm(m1(x),…,md − 1(x)). It can be seen that g(x) is a polynomial with coefficients in GF(q) and divides xn − 1. Therefore, the polynomial code defined by g(x) is a cyclic code.

Example

Let q=2 and m=4 (therefore n=15). We will consider different values of d. There is a primitive root α in GF(16) satisfying

its minimal polynomial over GF(2) is

m 1 ( x ) = x 4 + x + 1.

The minimal polynomials of the first fourteen powers of α are

m 1 ( x ) = m 2 ( x ) = m 4 ( x ) = m 8 ( x ) = x 4 + x + 1 , m 3 ( x ) = m 6 ( x ) = m 9 ( x ) = m 12 ( x ) = x 4 + x 3 + x 2 + x + 1 , m 5 ( x ) = m 10 ( x ) = x 2 + x + 1 , m 7 ( x ) = m 11 ( x ) = m 13 ( x ) = m 14 ( x ) = x 4 + x 3 + 1.

The BCH code with d = 2 , 3 has generator polynomial

g ( x ) = m 1 ( x ) = x 4 + x + 1.

It has minimal Hamming distance at least 3 and corrects up to one error. Since the generator polynomial is of degree 4, this code has 11 data bits and 4 checksum bits.

The BCH code with d = 4 , 5 has generator polynomial

g ( x ) = l c m ( m 1 ( x ) , m 3 ( x ) ) = ( x 4 + x + 1 ) ( x 4 + x 3 + x 2 + x + 1 ) = x 8 + x 7 + x 6 + x 4 + 1.

It has minimal Hamming distance at least 5 and corrects up to two errors. Since the generator polynomial is of degree 8, this code has 7 data bits and 8 checksum bits.

The BCH code with d = 8 and higher has generator polynomial

g ( x ) = l c m ( m 1 ( x ) , m 3 ( x ) , m 5 ( x ) , m 7 ( x ) ) = ( x 4 + x + 1 ) ( x 4 + x 3 + x 2 + x + 1 ) ( x 2 + x + 1 ) ( x 4 + x 3 + 1 ) = x 14 + x 13 + x 12 + + x 2 + x + 1.

This code has minimal Hamming distance 15 and corrects 7 errors. It has 1 data bit and 14 checksum bits. In fact, this code has only two codewords: 000000000000000 and 111111111111111.

General BCH codes

General BCH codes differ from primitive narrow-sense BCH codes in two respects.

First, the requirement that α be a primitive element of G F ( q m ) can be relaxed. By relaxing this requirement, the code length changes from q m 1 to o r d ( α ) , the order of the element α .

Second, the consecutive roots of the generator polynomial may run from α c , , α c + d 2 instead of α , , α d 1 .

Definition. Fix a finite field G F ( q ) , where q is a prime power. Choose positive integers m , n , d , c such that 2 d n , g c d ( n , q ) = 1 , and m is the multiplicative order of q modulo n .

As before, let α be a primitive n th root of unity in G F ( q m ) , and let m i ( x ) be the minimal polynomial over G F ( q ) of α i for all i . The generator polynomial of the BCH code is defined as the least common multiple g ( x ) = l c m ( m c ( x ) , , m c + d 2 ( x ) ) .

Note: if n = q m 1 as in the simplified definition, then g c d ( n , q ) is 1, and the order of q modulo n is m . Therefore, the simplified definition is indeed a special case of the general one.

Special cases

  • A BCH code with c = 1 is called a narrow-sense BCH code.
  • A BCH code with n = q m 1 is called primitive.
  • The generator polynomial g ( x ) of a BCH code has coefficients from G F ( q ) . In general, a cyclic code over G F ( q p ) with g ( x ) as the generator polynomial is called a BCH code over G F ( q p ) . The BCH code over G F ( q m ) with g ( x ) as the generator polynomial is called a Reed–Solomon code. In other words, a Reed–Solomon code is a BCH code where the decoder alphabet is the same as the channel alphabet.

    Properties

    The generator polynomial of a BCH code has degree at most ( d 1 ) m . Moreover, if q = 2 and c = 1 , the generator polynomial has degree at most d m / 2 .

    A BCH code has minimal Hamming distance at least d .

    A BCH code is cyclic.

    Decoding

    There are many algorithms for decoding BCH codes. The most common ones follow this general outline:

    1. Calculate the syndromes sj for the received vector
    2. Determine the number of errors t and the error locator polynomial Λ(x) from the syndromes
    3. Calculate the roots of the error location polynomial to find the error locations Xi
    4. Calculate the error values Yi at those error locations
    5. Correct the errors

    During some of these steps, the decoding algorithm may determine that the received vector has too many errors and cannot be corrected. For example, if an appropriate value of t is not found, then the correction would fail. In a truncated (not primitive) code, an error location may be out of range. If the received vector has more errors than the code can correct, the decoder may unknowingly produce an apparently valid message that is not the one that was sent.

    Calculate the syndromes

    The received vector R is the sum of the correct codeword C and an unknown error vector E . The syndrome values are formed by considering R as a polynomial and evaluating it at α c , , α c + d 2 . Thus the syndromes are

    s j = R ( α j ) = C ( α j ) + E ( α j )

    for j = c to c + d 2. Since α j are the zeros of g ( x ) , of which C ( x ) is a multiple, C ( α j ) = 0. Examining the syndrome values thus isolates the error vector so one can begin to solve for it.

    If there is no error, s j = 0 for all j . If the syndromes are all zero, then the decoding is done.

    Calculate the error location polynomial

    If there are nonzero syndromes, then there are errors. The decoder needs to figure out how many errors and the location of those errors.

    If there is a single error, write this as E ( x ) = e x i , where i is the location of the error and e is its magnitude. Then the first two syndromes are

    s c = e α c i s c + 1 = e α ( c + 1 ) i = α i s c

    so together they allow us to calculate e and provide some information about i (completely determining it in the case of Reed–Solomon codes).

    If there are two or more errors,

    E ( x ) = e 1 x i 1 + e 2 x i 2 +

    It is not immediately obvious how to begin solving the resulting syndromes for the unknowns e k and i k . First step is finding locator polynomial

    Λ ( x ) = j = 1 t ( x α i j 1 ) compatible with computed syndromes and with minimal possible t .

    Two popular algorithms for this task are:

    1. Peterson–Gorenstein–Zierler algorithm
    2. Berlekamp–Massey algorithm

    Peterson–Gorenstein–Zierler algorithm

    Peterson's algorithm is the step 2 of the generalized BCH decoding procedure. Peterson's algorithm is used to calculate the error locator polynomial coefficients λ 1 , λ 2 , , λ v of a polynomial

    Λ ( x ) = 1 + λ 1 x + λ 2 x 2 + + λ v x v .

    Now the procedure of the Peterson–Gorenstein–Zierler algorithm. Expect we have at least 2t syndromes sc,...,sc+2t−1. Let v = t.

  • Start by generating the S v × v matrix with elements that are syndrome values
  • Generate a c v × 1 vector with elements
  • Let Λ denote the unknown polynomial coefficients, which are given by
  • Form the matrix equation
  • If the determinant of matrix S v × v is nonzero, then we can actually find an inverse of this matrix and solve for the values of unknown Λ values.
  • If det ( S v × v ) = 0 , then follow
  • if v = 0 then declare an empty error locator polynomial stop Peterson procedure. end set v v 1 continue from the beginning of Peterson's decoding by making smaller S v × v
  • After you have values of Λ , you have with you the error locator polynomial.
  • Stop Peterson procedure.
  • Factor error locator polynomial

    Now that you have the Λ ( x ) polynomial, its roots can be found in the form Λ ( x ) = ( α i 1 x 1 ) ( α i 2 x 1 ) ( α i v x 1 ) by brute force for example using the Chien search algorithm. The exponential powers of the primitive element α will yield the positions where errors occur in the received word; hence the name 'error locator' polynomial.

    The zeros of Λ(x) are αi1, ..., αiv.

    Calculate error values

    Once the error locations are known, the next step is to determine the error values at those locations. The error values are then used to correct the received values at those locations to recover the original codeword.

    For the case of binary BCH, (with all characters readable) this is trivial; just flip the bits for the received word at these positions, and we have the corrected code word. In the more general case, the error weights e j can be determined by solving the linear system

    s c = e 1 α c i 1 + e 2 α c i 2 + s c + 1 = e 1 α ( c + 1 ) i 1 + e 2 α ( c + 1 ) i 2 +  

    Forney algorithm

    However, there is a more efficient method known as the Forney algorithm.

    Let

    S ( x ) = s c + s c + 1 x + s c + 2 x 2 + + s c + d 2 x d 2 . v d 1 , λ 0 0 Λ ( x ) = i = 0 v λ i x i = λ 0 k = 0 v ( α i k x 1 ) .

    And the error evaluator polynomial

    Ω ( x ) S ( x ) Λ ( x ) mod x d 1

    Finally:

    Λ ( x ) = i = 1 v i λ i x i 1 ,

    where

    i x := k = 1 i x .

    Than if syndromes could be explained by an error word, which could be nonzero only on positions i k , then error values are

    e k = α i k Ω ( α i k ) α c i k Λ ( α i k ) .

    For narrow-sense BCH codes, c = 1, so the expression simplifies to:

    e k = Ω ( α i k ) Λ ( α i k ) .

    Explanation of Forney algorithm computation

    It is based on Lagrange interpolation and techniques of generating functions.

    Consider S ( x ) Λ ( x ) , and for the sake of simplicity suppose λ k = 0 for k > v , and s k = 0 for k > c + d 2. Then

    S ( x ) Λ ( x ) = j = 0 i = 0 j s j i + 1 λ i x j . S ( x ) Λ ( x ) = S ( x ) { λ 0 = 1 v ( α i x 1 ) } = { i = 0 d 2 j = 1 v e j α ( c + i ) i j x i } { λ 0 = 1 v ( α i x 1 ) } = { j = 1 v e j α c i j i = 0 d 2 ( α i j ) i x i } { λ 0 = 1 v ( α i x 1 ) } = { j = 1 v e j α c i j ( x α i j ) d 1 1 x α i j 1 } { λ 0 = 1 v ( α i x 1 ) } = λ 0 j = 1 v e j α c i j ( x α i j ) d 1 1 x α i j 1 = 1 v ( α i x 1 ) = λ 0 j = 1 v e j α c i j ( ( x α i j ) d 1 1 ) { 1 , , v } { j } ( α i x 1 )

    We want to compute unknowns e j , and we could simplify the context by removing the ( x α i j ) d 1 terms. This leads to the error evaluator polynomial

    Ω ( x ) S ( x ) Λ ( x ) mod x d 1 .

    Thanks to v d 1 we have

    Ω ( x ) = λ 0 j = 1 v e j α c i j { 1 , , v } { j } ( α i x 1 ) .

    Thanks to Λ (the Lagrange interpolation trick) the sum degenerates to only one summand for x = α i k

    Ω ( α i k ) = λ 0 e k α c i k { 1 , , v } { k } ( α i α i k 1 ) .

    To get e k we just should get rid of the product. We could compute the product directly from already computed roots α i j of Λ , but we could use simpler form.

    As formal derivative

    Λ ( x ) = λ 0 j = 1 v α i j { 1 , , v } { j } ( α i x 1 ) ,

    we get again only one summand in

    Λ ( α i k ) = λ 0 α i k { 1 , , v } { k } ( α i α i k 1 ) .

    So finally

    e k = α i k Ω ( α i k ) α c i k Λ ( α i k ) .

    This formula is advantageous when one computes the formal derivative of Λ form

    Λ ( x ) = i = 1 v λ i x i

    yielding:

    Λ ( x ) = i = 1 v i λ i x i 1 ,

    where

    i x := k = 1 i x .

    Decoding based on extended Euclidean algorithm

    An alternate process of finding both the polynomial Λ and the error locator polynomial is based on Yasuo Sugiyama's adaptation of the Extended Euclidean algorithm. Correction of unreadable characters could be incorporated to the algorithm easily as well.

    Let k 1 , . . . , k k be positions of unreadable characters. One creates polynomial localising these positions Γ ( x ) = i = 1 k ( x α k i 1 ) . Set values on unreadable positions to 0 and compute the syndromes.

    As we have already defined for the Forney formula let S ( x ) = i = 0 d 2 s c + i x i .

    Let us run extended Euclidean algorithm for locating least common divisor of polynomials S ( x ) Γ ( x ) and x d 1 . The goal is not to find the least common divisor, but a polynomial r ( x ) of degree at most ( d + k 3 ) / 2 and polynomials a ( x ) , b ( x ) such that r ( x ) = a ( x ) S ( x ) Γ ( x ) + b ( x ) x d 1 . Low degree of r ( x ) guarantees, that a ( x ) would satisfy extended (by Γ ) defining conditions for Λ .

    Defining Ξ ( x ) = a ( x ) Γ ( x ) and using Ξ on the place of Λ ( x ) in the Fourney formula will give us error values.

    The main advantage of the algorithm is that it meanwhile computes Ω ( x ) = S ( x ) Ξ ( x ) mod x d 1 = r ( x ) required in the Forney formula.

    Explanation of the decoding process

    The goal is to find a codeword which differs from the received word minimally as possible on readable positions. When expressing the received word as a sum of nearest codeword and error word, we are trying to find error word with minimal number of non-zeros on readable positions. Syndrom s i restricts error word by condition

    s i = j = 0 n 1 e j α i j .

    We could write these conditions separately or we could create polynomial

    S ( x ) = i = 0 d 2 s c + i x i

    and compare coefficients near powers 0 to d 2.

    S ( x ) = { 0 , , d 2 } E ( x ) = i = 0 d 2 j = 0 n 1 e j α i j α c j x i .

    Suppose there is unreadable letter on position k 1 , we could replace set of syndromes { s c , , s c + d 2 } by set of syndromes { t c , , t c + d 3 } defined by equation t i = α k 1 s i s i + 1 . Suppose for an error word all restrictions by original set { s c , , s c + d 2 } of syndromes hold, than

    t i = α k 1 s i s i + 1 = α k 1 j = 0 n 1 e j α i j j = 0 n 1 e j α j α i j = j = 0 n 1 e j ( α k 1 α j ) α i j .

    New set of syndromes restricts error vector

    f j = e j ( α k 1 α j )

    the same way the original set of syndromes restricted the error vector e j . Note, that except the coordinate k 1 , where we have f k 1 = 0 , an f j is zero, if e j = 0. For the goal of locating error positions we could change the set of syndromes in the similar way to reflect all unreadable characters. This shortens the set of syndromes by k .

    In polynomial formulation, the replacement of syndromes set { s c , , s c + d 2 } by syndromes set { t c , , t c + d 3 } leads to

    T ( x ) = i = 0 d 3 t c + i x i = α k 1 i = 0 d 3 s c + i x i i = 1 d 2 s c + i x i 1 .

    Therefore

    x T ( x ) = { 1 , , d 2 } ( x α k 1 1 ) S ( x ) .

    After replacement of S ( x ) by S ( x ) Γ ( x ) , one would require equation for coefficients near powers k , , d 2.

    One could consider looking for error positions from the point of view of eliminating influence of given positions similarly as for unreadable characters. If we found v positions such that eliminating their influence leads to obtaining set of syndromes consisting of all zeros, than there exists error vector with errors only on these coordinates. If Λ ( x ) denotes the polynomial eliminating the influence of these coordinates, we obtain

    S ( x ) Γ ( x ) Λ ( x ) = { k + v , , d 2 } 0.

    In Euclidean algorithm, we try to correct at most 1 2 ( d 1 k ) errors (on readable positions), because with bigger error count there could be more codewords in the same distance from the received word. Therefore, for Λ ( x ) we are looking for, the equation must hold for coefficients near powers starting from

    k + 1 2 ( d 1 k ) .

    In Forney formula, Λ ( x ) could be multiplied by a scalar giving the same result.

    It could happen that the Euclidean algorithm finds Λ ( x ) of degree higher than 1 2 ( d 1 k ) having number of different roots equal to its degree, where the Fourney formula would be able to correct errors in all its roots, anyways correcting such many errors could be risky (especially with no other restrictions on received word). Usually after getting Λ ( x ) of higher degree, we decide not to correct the errors. Correction could fail in the case Λ ( x ) has roots with higher multiplicity or the number of roots is smaller than its degree. Fail could be detected as well by Forney formula returning error outside the transmitted alphabet.

    Correct the errors

    Using the error values and error location, correct the errors and form a corrected code vector by subtracting error values at error locations.

    Decoding of binary code without unreadable characters

    Consider a BCH code in GF(24) with d = 7 and g ( x ) = x 10 + x 8 + x 5 + x 4 + x 2 + x + 1 . (This is used in QR codes.) Let the message to be transmitted be [1 1 0 1 1], or in polynomial notation, M ( x ) = x 4 + x 3 + x + 1. The "checksum" symbols are calculated by dividing x 10 M ( x ) by g ( x ) and taking the remainder, resulting in x 9 + x 4 + x 2 or [ 1 0 0 0 0 1 0 1 0 0 ]. These are appended to the message, so the transmitted codeword is [ 1 1 0 1 1 1 0 0 0 0 1 0 1 0 0 ].

    Now, imagine that there are two bit-errors in the transmission, so the received codeword is [ 1 0 0 1 1 1 0 0 0 1 1 0 1 0 0 ]. In polynomial notation:

    R ( x ) = C ( x ) + x 13 + x 5 = x 14 + x 11 + x 10 + x 9 + x 5 + x 4 + x 2

    In order to correct the errors, first calculate the syndromes. Taking α = 0010 , we have s 1 = R ( α 1 ) = 1011 , s 2 = 1001 , s 3 = 1011 , s 4 = 1101 , s 5 = 0001 , and s 6 = 1001. Next, apply the Peterson procedure by row-reducing the following augmented matrix.

    [ S 3 × 3 | C 3 × 1 ] = [ s 1 s 2 s 3 s 4 s 2 s 3 s 4 s 5 s 3 s 4 s 5 s 6 ] = [ 1011 1001 1011 1101 1001 1011 1101 0001 1011 1101 0001 1001 ] [ 0001 0000 1000 0111 0000 0001 1011 0001 0000 0000 0000 0000 ]

    Due to the zero row, S3×3 is singular, which is no surprise since only two errors were introduced into the codeword. However, the upper-left corner of the matrix is identical to [S2×2 | C2×1], which gives rise to the solution λ 2 = 1000 , λ 1 = 1011. The resulting error locator polynomial is Λ ( x ) = 1000 x 2 + 1011 x + 0001 , which has zeros at 0100 = α 13 and 0111 = α 5 . The exponents of α correspond to the error locations. There is no need to calculate the error values in this example, as the only possible value is 1.

    Decoding with unreadable characters

    Suppose the same scenario, but the received word has two unreadable characters [ 1 0 0 ? 1 1 ? 0 0 1 1 0 1 0 0 ]. We replace the unreadable characters by zeros while creating the polynom reflecting their positions Γ ( x ) = ( α 8 x 1 ) ( α 11 x 1 ) . We compute the syndromes s 1 = α 7 , s 2 = α 1 , s 3 = α 4 , s 4 = α 2 , s 5 = α 5 , and s 6 = α 7 . (Using log notation which is independent on GF(24) isomorphisms. For computation checking we can use the same representation for addition as was used in previous example. Hexadecimal description of the powers of α are consecutively 1,2,4,8,3,6,C,B,5,A,7,E,F,D,9 with the addition based on bitwise xor.)

    Let us make syndrome polynomial

    S ( x ) = α 7 + α 1 x + α 4 x 2 + α 2 x 3 + α 5 x 4 + α 7 x 5 ,

    compute

    S ( x ) Γ ( x ) = α 7 + α 4 x + α 1 x 2 + α 6 x 3 + α 1 x 4 + α 5 x 5 + α 7 x 6 + α 3 x 7 .

    Run the extended Euclidean algorithm:

    ( S ( x ) Γ ( x ) x 6 ) = ( α 7 + α 4 x + α 1 x 2 + α 6 x 3 + α 1 x 4 + α 5 x 5 + α 7 x 6 + α 3 x 7 x 6 ) = ( α 7 + α 3 x 1 1 0 ) ( x 6 α 7 + α 4 x + α 1 x 2 + α 6 x 3 + α 1 x 4 + α 5 x 5 + 2 α 7 x 6 + 2 α 3 x 7 ) = ( α 7 + α 3 x 1 1 0 ) ( α 4 + α 5 x 1 1 0 ) × × ( α 7 + α 4 x + α 1 x 2 + α 6 x 3 + α 1 x 4 + α 5 x 5 α 3 + ( α 7 + α 3 ) x + ( α 3 + α 1 ) x 2 + ( α 5 + α 6 ) x 3 + ( α 3 + α 1 ) x 4 + 2 α 6 x 5 + 2 x 6 ) = ( ( 1 + α 4 ) + ( α 1 + α 2 ) x + α 7 x 2 α 7 + α 3 x α 4 + α 5 x 1 ) ( α 7 + α 4 x + α 1 x 2 + α 6 x 3 + α 1 x 4 + α 5 x 5 α 3 + α 2 x + α 0 x 2 + α 2 x 3 + α 6 x 4 ) = ( α 3 + α 5 x + α 7 x 2 α 7 + α 3 x α 4 + α 5 x 1 ) ( α 5 + α 4 x 1 1 0 ) × × ( α 3 + α 2 x + α 0 x 2 + α 2 x 3 + α 6 x 4 ( α 7 + α 7 ) + ( 2 α 7 + α 4 ) x + ( α 5 + α 6 + α 1 ) x 2 + ( α 7 + α 4 + α 6 ) x 3 + ( α 4 + α 6 + α 1 ) x 4 + 2 α 5 x 5 ) = ( α 7 x + α 5 x 2 + α 3 x 3 α 3 + α 5 x + α 7 x 2 α 3 + α 5 x + α 6 x 2 α 4 + α 5 x ) ( α 3 + α 2 x + α 0 x 2 + α 2 x 3 + α 6 x 4 α 4 + α 4 x + α 2 x 2 + α 5 x 3 ) .

    We have reached polynomial of degree at most 3, and as

    ( ( α 4 + α 5 x ) α 3 + α 5 x + α 7 x 2 α 3 + α 5 x + α 6 x 2 ( α 7 x + α 5 x 2 + α 3 x 3 ) ) ( α 7 x + α 5 x 2 + α 3 x 3 α 3 + α 5 x + α 7 x 2 α 3 + α 5 x + α 6 x 2 α 4 + α 5 x ) = ( 1 0 0 1 ) ,

    we get

    ( ( α 4 + α 5 x ) α 3 + α 5 x + α 7 x 2 α 3 + α 5 x + α 6 x 2 ( α 7 x + α 5 x 2 + α 3 x 3 ) ) ( S ( x ) Γ ( x ) x 6 ) = ( α 3 + α 2 x + α 0 x 2 + α 2 x 3 + α 6 x 4 α 4 + α 4 x + α 2 x 2 + α 5 x 3 ) .

    Therefore

    S ( x ) Γ ( x ) ( α 3 + α 5 x + α 6 x 2 ) ( α 7 x + α 5 x 2 + α 3 x 3 ) x 6 = α 4 + α 4 x + α 2 x 2 + α 5 x 3 .

    Let Λ ( x ) = α 3 + α 5 x + α 6 x 2 . Don't worry that λ 0 1. Find by brute force a root of Λ . The roots are α 2 , and α 10 (after finding for example α 2 we can divide Λ by corresponding monom ( x α 2 ) and the root of resulting monom could be found easily).

    Let

    Ξ ( x ) = Γ ( x ) Λ ( x ) = α 3 + α 4 x 2 + α 2 x 3 + α 5 x 4 Ω ( x ) = S ( x ) Ξ ( x ) α 4 + α 4 x + α 2 x 2 + α 5 x 3 mod x 6

    Let us look for error values using formula

    e j = Ω ( α i j ) Ξ ( α i j ) ,

    where α i j are roots of Ξ ( x ) . Ξ ( x ) = α 2 x 2 . We get

    e 1 = Ω ( α 4 ) Ξ ( α 4 ) = α 4 + α 7 + α 5 + α 7 α 5 = α 5 α 5 = 1 e 2 = Ω ( α 7 ) Ξ ( α 7 ) = α 4 + α 4 + α 1 + α 1 α 1 = 0 e 3 = Ω ( α 10 ) Ξ ( α 10 ) = α 4 + α 1 + α 7 + α 5 α 7 = α 7 α 7 = 1 e 4 = Ω ( α 2 ) Ξ ( α 2 ) = α 4 + α 6 + α 6 + α 1 α 6 = α 6 α 6 = 1

    Fact, that e 3 = e 4 = 1 , should not be surprising.

    Corrected code is therefore [ 1 1 0 1 1 1 0 0 0 0 1 0 1 0 0].

    Decoding with unreadable characters with a small number of errors

    Let us show the algorithm behaviour for the case with small number of errors. Let the received word is [ 1 0 0 ? 1 1 ? 0 0 0 1 0 1 0 0 ].

    Again, replace the unreadable characters by zeros while creating the polynom reflecting their positions Γ ( x ) = ( α 8 x 1 ) ( α 11 x 1 ) . Compute the syndromes s 1 = α 4 , s 2 = α 7 , s 3 = α 1 , s 4 = α 1 , s 5 = α 0 , and s 6 = α 2 . Create syndrome polynomial

    S ( x ) = α 4 + α 7 x + α 1 x 2 + α 1 x 3 + α 0 x 4 + α 2 x 5 , S ( x ) Γ ( x ) = α 4 + α 7 x + α 5 x 2 + α 3 x 3 + α 1 x 4 + α 1 x 5 + α 1 x 6 + α 6 x 7 .

    Let us run the extended Euclidean algorithm:

    ( S ( x ) Γ ( x ) x 6 ) = ( α 4 + α 7 x + α 5 x 2 + α 3 x 3 + α 1 x 4 + α 1 x 5 + α 1 x 6 + α 6 x 7 x 6 ) = ( α 1 + α 6 x 1 1 0 ) ( x 6 α 4 + α 7 x + α 5 x 2 + α 3 x 3 + α 1 x 4 + α 1 x 5 + 2 α 1 x 6 + 2 α 6 x 7 ) = ( α 1 + α 6 x 1 1 0 ) ( α 3 + α 1 x 1 1 0 ) ( α 4 + α 7 x + α 5 x 2 + α 3 x 3 + α 1 x 4 + α 1 x 5 α 7 + ( α 5 + α 5 ) x + 2 α 7 x 2 + 2 α 6 x 3 + 2 α 4 x 4 + 2 α 2 x 5 + 2 x 6 ) = ( ( 1 + α 2 ) + ( α 0 + α 6 ) x + α 7 x 2 α 1 + α 6 x α 3 + α 1 x 1 ) ( α 4 + α 7 x + α 5 x 2 + α 3 x 3 + α 1 x 4 + α 1 x 5 α 7 + α 0 x )

    We have reached polynomial of degree at most 3, and as

    ( 1 α 1 + α 6 x α 3 + α 1 x ( α 7 + α 7 x + α 7 x 2 ) ) ( α 7 + α 7 x + α 7 x 2 α 1 + α 6 x α 3 + α 1 x 1 ) = ( 1 0 0 1 ) ,

    we get

    ( 1 α 1 + α 6 x α 3 + α 1 x ( α 7 + α 7 x + α 7 x 2 ) ) ( S ( x ) Γ ( x ) x 6 ) = ( α 4 + α 7 x + α 5 x 2 + α 3 x 3 + α 1 x 4 + α 1 x 5 α 7 + α 0 x ) .

    Therefore,

    S ( x ) Γ ( x ) ( α 3 + α 1 x ) ( α 7 + α 7 x + α 7 x 2 ) x 6 = α 7 + α 0 x .

    Let Λ ( x ) = α 3 + α 1 x . Don't worry that λ 0 1. The root of Λ ( x ) is α 3 1 .

    Let

    Ξ ( x ) = Γ ( x ) Λ ( x ) = α 3 + α 7 x + α 4 x 2 + α 5 x 3 , Ω ( x ) = S ( x ) Ξ ( x ) α 7 + α 0 x mod x 6

    Let us look for error values using formula e j = Ω ( α i j ) / Ξ ( α i j ) , where α i j are roots of polynomial Ξ ( x ) . Ξ ( x ) = α 7 + α 5 x 2 . We get

    e 1 = Ω ( α 4 ) Ξ ( α 4 ) = α 7 + α 4 α 7 + α 2 = α 3 α 3 = 1 e 2 = Ω ( α 7 ) Ξ ( α 7 ) = α 7 + α 7 α 7 + α 4 = 0 e 3 = Ω ( α 2 ) Ξ ( α 2 ) = α 7 + α 2 α 7 + α 6 = α 3 α 3 = 1

    The fact that e 3 = 1 should not be surprising.

    Corrected code is therefore [ 1 1 0 1 1 1 0 0 0 0 1 0 1 0 0].

    References

    BCH code Wikipedia