Program 8 CRC
Program 8 CRC
Algorithm
1. A string of n as is appended to the data unit. The length of predetermined divisor is n+ 1.
2. The newly formed data unit 1. A string of n as is appended to the data unit. The length of
predetermined divisor is n+ 1. i.e. original data + string of n as are divided by the divisor
using binary division and remainder is obtained. This remainder is called CRC.
3. Now, string of n O s appended to data unit is replaced by the CRC remainder (which is
also of n bit).
4. The data unit + CRC is then transmitted to receiver.
5. The receiver on receiving it divides data unit + CRC by the same divisor & checks the
remainder.
6. If the remainder of division is zero, receiver assumes that there is no error in data and it
accepts it.
7. If remainder is non-zero then there is an error in data and receiver rejects it.
Program:
#include <stdio.h>
#include <string.h>
int main() {
int i, j, k, m, n, cl;
char a[10], b[100], c[100];
m = strlen(a);
n = strlen(b);
cl = m + n - 1;
return 0;
}
OUTPUT:
ENTER POLYNOMIAL: 1011
int main() {
int i, j, k, m, n, cl;
char a[10], c[100];
m = strlen(a);
cl = strlen(c);
n = cl - m + 1;
return 0;
}
OUTPUT:
ENTER POLYNOMIAL: 1011
MESSAGE IS CORRECT