Cyclic Redundancy Check Program in C - CRC
Cyclic Redundancy Check Program in C - CRC
https://onlinesmarttrainer.blogspot.com/2021/02/cyclic-redundancy-check.html 1/3
27/10/2024, 11:38 Cyclic Redundancy Check program in C | CRC
Write a program to compute CRC code for the polynomials CRC-12, CRC-16 and CRC
CCIP
Theory:
Cyclic Redundancy Checks fall into the same category as parity bits, check digits, and checksums: Their
use is to detect transmission errors. Depending on the error model assumed (i.e., what types of
transmission errors are to be expected, which typically depends on the transmission media), different forms
of checking are appropriate.
This technique involves binary division of the data bits being sent. The divisor is generated using
polynomials. The sender performs a division operation on the bits being sent and calculates the remainder.
Before sending the actual bits, the sender adds the remainder at the end of the actual bits. Actual data bits
plus the remainder is called a codeword. The sender transmits data bits as code-words. At the other end,
the receiver performs division operation on code-words using the same CRC divisor. If the remainder
contains all zeros the data bits are accepted, otherwise it is considered as there some data corruption
occurred in transit.
SOURCE CODE:
#include<stdio.h>
void main ( )
int i,j,fr[8],dupfr[11],recfr[11],tlen,flag;
frl=8; genl=4;
dupfr[i]=fr[i];
printf("Enter generator:\n");
tlen=frl+genl-1;
for(i=frl;i<tlen;i++)
dupfr[i] =0;
remainder(dupfr);
recfr[i]=fr[i];
for(i=frl,j=1;j<genl;i++,j++)
recfr[i]=rem[j];
remainder(recfr);
flag=0;
for(i=0;i<4;i++)
if(rem[i]!=0)
flag++;
if (flag==0)
else
int k,k1,i,j;
for(k=0;k<frl;k++)
if (fr[k]==1)
k1=k;
for (i=0,j=k;i<genl;i++,j++)
rem[i]=fr[j]^gen[i];
for(i=0;i<genl;i++)
fr[k1]=rem[i];
k1++;
return 0;
OUTPUT CONSOLE:
CRC
https://onlinesmarttrainer.blogspot.com/2021/02/cyclic-redundancy-check.html 2/3
27/10/2024, 11:38 Cyclic Redundancy Check program in C | CRC
Create this charitable of companions you consideration about precisely what therefore grief-favored
beside contemplates to most of these tows which are fact produced. IR Repeater
REPLY
NEW
Labels
YouTube Video
Introduction to Automata Theory
Basic Concepts of Automata
Kleene Closure and Postive Closure
Strassen's Matrix Multiplication
https://onlinesmarttrainer.blogspot.com/2021/02/cyclic-redundancy-check.html 3/3