Algorithm Steps:
Step 1: Declare int crc 16, SHIFT_CRC, shift Byte, Byte_SIZE as global variables.
Step 2: Input the data in a file.
Step 3: perform the crc computation using cal CRC 16 ().
Step 4: In cal CRC 16 each character from input shifted with shift-byte where value 987.
Step 5: Output of step 4 and step 5 are exclusive.
Step 6: store in a temporary variable.
Step 7: Byte value is now left_shifted by 1.
Step 8: The loop is repeated for the Byte_size.
Step 9: The computed crc is display as output in screen.
C Program To Implement CRC
#include
int i.data[10].dl.gen[10],gl,temp[10],c;
void left_shift()
{
for(i=0;i
SAMPLE INPUT OUTPUT:
[csea56@localhost cse156]$ cc crc.c
[csea56@localhost cse156]$./a.out
1.generate2.check
choide:1
Enter the length of data:6
Enter the data:1
0
1
1
0
1
Enter the length of generator:4
Enter the generator:1
1
0
1
crc:101101001
|