Professional Documents
Culture Documents
GROUP MEMBERS:
IRFAN JUNAID (13005162002)
KANDUNURU GOWTHAM
(130051601033)
RAMKUMAR(130051602006)
CRC GENERATOR
A cyclic redundancy check (CRC) is an error-detecting
code commonly used in digital networks and storage devices to
detect accidental changes to raw data. Blocks of data entering these
systems get a short check value attached, based on the remainder of
a polynomial division of their contents
Because the check value has a fixed length, the function that
generates it is occasionally used as a hash function.
You could transmit every piece of information twice and if on the receiving
end you see that the first one is different to the second one you know an
error has occurred and you need to request the data again - but this would be
very wasteful, it would effectively cut your bandwidth in half.
Now, what if you could calculate some value that is much smaller than the
data itself yet is depen😂dent on it? So if the data changed along the way
(due to error), the calculated value would no longer "match" the data and
you would know an error has occurred. Is there such a calculation?
#include <conio.h>
#include <string.h>
int main() {
int i,j,keylen,msglen;
clrscr();
gets(input);
gets(key);
keylen=strlen(key);
msglen=strlen(input);
strcpy(key1,key);
for (i=0;i<keylen-1;i++) {
input[msglen+i]='0';
for (i=0;i<keylen;i++)
temp[i]=input[i];
for (i=0;i<msglen;i++) {
quot[i]=temp[0];
if(quot[i]=='0')
for (j=0;j<keylen;j++)
key[j]='0'; else
for (j=0;j<keylen;j++)
key[j]=key1[j];
for (j=keylen-1;j>0;j--) {
if(temp[j]==key[j])
rem[j-1]='0'; else
rem[j-1]='1';
}
rem[keylen-1]=input[i+keylen];
strcpy(temp,rem);
strcpy(rem,temp);
printf("\nQuotient is ");
for (i=0;i<msglen;i++)
printf("%c",quot[i]);
printf("\nRemainder is ");
for (i=0;i<keylen-1;i++)
printf("%c",rem[i]);
for (i=0;i<msglen;i++)
printf("%c",input[i]);
for (i=0;i<keylen-1;i++)
printf("%c",rem[i]);
getch();
return 0;
OUTPUT: