Refer to MacWilliams and Sloane's "The theory of Error-Correcting Codes" and Berlekamp's "Algebraic coding theory" for all the terms used here. You can find on the internet a table of primitive binary polynomials, which can be used as a source of polynomials as in the file primitive-polynomials.csv.
This repository contains a program for encoding and decoding an input string with a BCH code. It:
- Builds a BCH code according to the specified parameters p - error probability in a noisy channel - and n - a target length of a code word. The code is capable of correcting an arbitrary number of errors.
- Changes n if it doesn't fit the specified probability of error in a channel.
- Splits a bit representation of the string onto small pieces, which satisfy the built BCH code and, therefore gets a so-called message.
- Encodes a message and gets a so-called code word.
- Emulates a noisy channel adding an arbitrary error to each code word.
- Corrects a distorted code word and decodes it into a message.
- Recovers a string putting all recovered messages back together.
To run the program use Python 3:
- Clone the repo using "git clone 'repo url'".
- Open the terminal and "cd 'directory where you just have cloned the repo'".
- Type "python3" in the prompt.
- Type "from noisychannel import simulate".
- Type "simulate()", it starts the program.
- Follow the instructions on the screen.