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 where is the location of the error and is its magnitude. Then the first two syndromes are so together they allow us to calculate and provide some information about (completely determining it in the case of Reed–Solomon codes). If there are two or more errors, It is not immediately obvious how to begin solving the resulting syndromes for the unknowns and The first step is finding, compatible with computed syndromes and with minimal possible locator polynomial: Three popular algorithms for this task are: Peterson–Gorenstein–Zierler algorithm Berlekamp–Massey algorithm Sugiyama Euclidean 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 of a polynomial Now the procedure of the Peterson–Gorenstein–Zierler algorithm. Expect we have at least 2t syndromes sc, …, sc+2t−1. Let v = t. Factor error locator polynomial Now that you have the polynomial, its roots can be found in the form 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 can be determined by solving the linear system Forney algorithm However, there is a more efficient method known as the Forney algorithm. Let And the error evaluator polynomial Finally: where Than if syndromes could be explained by an error word, which could be nonzero only on positions , then error values are For narrow-sense BCH codes, c = 1, so the expression simplifies to: Explanation of Forney algorithm computation It is based on Lagrange interpolation and techniques of generating functions.