- Shreyas IMT2022006
- Sathvik IMT2022082
The Reed-Solomon simulation emulates a coding scheme widely used in error correction and data transmission applications. It operates based on Reed-Solomon codes, which are a class of error-correcting codes used for data transmission over noisy channels, such as in satellite communication, digital television, and storage systems like CDs, DVDs, and Blu-ray discs.
Reed-Solomon codes add redundancy to transmitted data, enabling the receiver to detect and correct errors. This redundancy is achieved by adding extra symbols to the original message before transmission. These extra symbols are computed based on the original message using polynomial operations.
-
Global Setup: Before transmitting data, the simulation requires global setup parameters, including the probability of error (
u
) and the size of the message space (M
). -
Data Transmission:
- The
ReedSolomonSend
method is used to transmit data. It takes the original message as input and generates additional redundant symbols based on Reed-Solomon encoding techniques. - Randomness is introduced to simulate noise in the transmission process, affecting a subset of symbols.
- The
-
Data Recovery:
- The
ReedSolomonReceive
method is used to recover the transmitted message. It employs decoding techniques based on Reed-Solomon codes to correct errors introduced during transmission and reconstruct the original message. - Thue's algorithm is used to solve linear Diophantine equations, which are instrumental in error correction.
- The
Reed-Solomon codes are essential in scenarios where reliable data transmission is crucial, especially in environments prone to noise and interference. By adding redundancy and employing sophisticated decoding techniques, Reed-Solomon codes ensure robustness and accuracy in data transmission, making them indispensable in various real-world applications.
The project is organized into several Python modules:
-
HelperFunctions Directory
- arithmeticOps.py: Contains various arithmetic operations such as modulo, power, division, logarithm, etc.
- BEGCD.py: Implements the Binary Extended Greatest Common Divisor (BEGCD) algorithm.
- CRT.py: Implements the Chinese Remainder Theorem (CRT) for large integers.
- MR2.py: Implements the Miller-Rabin primality test for generating random primes.
- Thues.py: Implements Thue's algorithm for finding solutions to linear Diophantine equations.
-
ReedSolomon.py: The main module that orchestrates the Reed-Solomon simulation. It imports functionalities from other modules to simulate data transmission and recovery.
- Modn: Computes x mod n.
- removeFactorOf2: Finds the highest power of 2 that divides a number.
- power: Computes x raised to the power of n.
- powerModN: Computes x raised to the power of n modulo m.
- division: Performs integer division.
- log2: Computes the base-2 logarithm of a number.
- begcd: Implements the Binary Extended Greatest Common Divisor (BEGCD) algorithm.
- CRT: Implements the Chinese Remainder Theorem (CRT) for solving systems of congruences.
- Primality: Implements the Miller-Rabin primality test for generating random primes.
- thue: Implements Thue's algorithm for finding solutions to linear Diophantine equations.
- ReedSolomonSimulation: Orchestrates the Reed-Solomon simulation, including global setup, data transmission, and recovery.
To use the Reed-Solomon simulation:
- Ensure all required Python modules are installed, especially
gmpy2
. - Import the
ReedSolomonSimulation
class fromReedSolomon.py
. - Initialize the simulation by calling the
GlobalSetup
method with the desired parameters (u
,M
). - Use the
ReedSolomonSend
method to transmit data by providing the message as input. - Call the
ReedSolomonReceive
method to receive the transmitted message. This method returns the recovered message.
Install the dependencies
pip install -r requirements.txt
Run
python3 reedSolomon.py
Example Usage:
from ReedSolomon import ReedSolomonSimulation
rs = ReedSolomonSimulation()
rs.GlobalSetup(0.3, 10**10) # Setting up global parameters
# Transmitting data
rs.ReedSolomonSend(int(input("Enter number to send:")))
try:
print("Received message is", rs.ReedSolomonReceive())
except Exception as e:
print("Could not recover message")