0% found this document useful (0 votes)
4 views1 page

CRC Sender

The document outlines a Python program for implementing a CRC (Cyclic Redundancy Check) sender. It prompts the user for the bit lengths of the data and generator, validates the input, and performs CRC calculations using an XOR function. The program ultimately outputs the parity bits generated from the input data and generator.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views1 page

CRC Sender

The document outlines a Python program for implementing a CRC (Cyclic Redundancy Check) sender. It prompts the user for the bit lengths of the data and generator, validates the input, and performs CRC calculations using an XOR function. The program ultimately outputs the parity bits generated from the input data and generator.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

CRC SENDER

Data=[]
N=int(input(“enter the bit length of the data”))
Gen=[]
M=int(input(“enter the bit length of the generator”))
If (n<m):
Print(“enter the valid data”)
Exit()
Print(“enter the data”)
For I in range(0,n):
X=int(input())
Data.append(x)
Data.extend([0]*(m-1))
Print(“enter the generator”)
For I in range(0,m):
X=int(input())
Gen.append(x)
If (n==m):
For I in range(0,n):
If (data[i]<gen[i]):
Print(“enter the valid data”)
Exit()
Print(“data after appending the code:”,data)
Print(“generator:”,gen)
Def exor(i1,i2):
Res=[]
For I in range(0,len(i1)):
Res.append(i1[i]^i2[i])
Return res
Def crc(data,gen):
Rem=data[:len(gen)]
For I in range(len(gen),len(data)+1):
If (rem[0]==0):
Rem.pop(0)
Else:
Rem=exor(gen,rem)
Rem.pop(0)
If i<len(data):
Rem.append(data[i])
Return rem
P_bits=crc(data,gen)
Print(“parity bits:",p_bits)

You might also like