Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I nedd a complete C langauge program for CRC calculation . The method for determ

ID: 3666400 • Letter: I

Question

I nedd a complete C langauge program for CRC calculation. The method for determining the CRC value to append to the message sent was discussed in class. For the method shown in class, extra 0’s were added on to the original message before the calculation took place.   
For this part of the project, show that by adding 1’s instead of 0’s results in the same CRC value added to the end of the message. Remember that all math is binary XOR and no bits carry.

The message and generator to use for this project are shown below:

M(X) = 1010110011100010

C(X) = 11011

Hint: The first part of the division is the same for the two calculations – only difference comes when you start bringing down the added in 0’s or 1’s

Explanation / Answer

#include<stdio.h>
#include <conio.h>
#include <string.h>
void main()
{
int m,n,keylen,datalen; //declare variables
char input[100], key[30],temp[30],quot[100],rem[30],key1[30];
clrscr();
printf("Enter Message Data: "); //enter data for checking
gets(input);
printf("Enter Key Element: ");//enter key
gets(key);
keylen=strlen(key); //check key length
datalen=strlen(input); //check input string length
strcpy(key1,key);
for(m=0;m<keylen-1;m++)// repeate the checking process untill length -1 and start from 0
{
input[datalen+m]='0';
}
for(m=0;m<keylen;m++)
temp[m]=input[m]; //temp is used for stored the input alue
for(m=0;m<datalen;m++)
{
quot[m]=temp[0];// assign the quetion value to the temp
if(quot[m]=='0') // check the condition
for(n=0;n<keylen;n++)
key[n]='0'; //compare the key element and find the reminder
else
for(n=0;n<keylen;n++)
key[n]=key1[n];
for(n=keylen-1;n>0;n--)
{
if(temp[n]==key[n])
rem[n-1]='0';
else
rem[n-1]='1';
}
rem[keylen-1]=input[m+keylen];
strcpy(temp,rem); //copy the reminder
}
strcpy(rem,temp);
printf(" Quotient is "); //print the quotient value
for(m=0;m<datalen;m++)
printf("%c",quot[m]);
printf(" Remainder is ");// primt the remainder
for(m=0;m<keylen-1;m++)
printf("%c",rem[m]);
printf(" Final data is: "); //calculate the final data
for(m=0;m<datalen;m++)
printf("%c",input[m]);
for(m=0;m<keylen-1;m++)
printf("%c",rem[m]);
getch();
}

output:

Enter Message Data

Enter Key Element

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote