Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C Program help I am trying to complete a C program that does C R C calculation . I got everyting to work except a

C Program help I am trying to complete a C program that does C R C calculation . I got everyting to work except a function to display binary difference at each X O R step .

the program compiles using two comand line arguments .

programName c [input Hex] : for calculation

programName v [input Hex] : for virification

The polynomial is always the same

here is how the output should look like :

image text in transcribed

image text in transcribed

image text in transcribed

Here is my code so far :

#include #include #include #include int i_temp=0; char* pointer_stop; int val =0; char binary[50000][12]; char binary_string[50000]; int length=0; int error=0; char input[50000]; char lowercase[50000]; char chksm[50000]; char tester[50000]; char string_end[50000]; char *polynomial;

//HEX-BINARY void HEXA_BIN(char *hexaDecimal) { long int i=0; char block[5]; while(hexaDecimal[i]) { switch(hexaDecimal[i]) { case '0': strcpy(block, "0000"); break; case '1': strcpy(block, "0001"); break; case '2': strcpy(block, "0010"); break; case '3': strcpy(block, "0011"); break; case '4': strcpy(block, "0100"); break; case '5': strcpy(block, "0101"); break; case '6': strcpy(block, "0110"); break; case '7': strcpy(block, "0111"); break; case '8': strcpy(block, "1000"); break; case '9': strcpy(block, "1001"); break; case 'a': strcpy(block, "1010"); break; case 'b': strcpy(block, "1011"); break; case 'c': strcpy(block, "1100"); break; case 'd': strcpy(block, "1101"); break; case 'e': strcpy(block, "1110"); break; case 'f': strcpy(block, "1111"); break; } i++; strcat(binary_string, block); } } void CrcChecker() { int i,p; int c; for(i=0; i

//BINARY-HEX void BIN_HEXA(char *binary) { long int dec; long int rm; long int qt; int i=1,j,temp; char hx[50000]; dec = strtol (binary,NULL,2); qt = dec; while(qt!=0) { temp = qt % 16; if( temp 0; j--) printf("%c",hx[j]); printf(" (hex)");

}

//MAIN int main(int argc, char *argv[]) { int i=0,e=0; int i_line=0; polynomial="1101"; polynomial="1100110110101"; int spacer=0;

strcpy(input, argv[2]); printf("----------------------------------------------------------------------- ");

//CHOOSE CALC MODE if (strcmp(argv[1], "c") == 0) { printf("The input string (hex): %s ", input);

for(i = 0; i

for(i=0; i

//CHOOSE VERIFY MODE else if (strcmp(argv[1], "v") == 0) { printf("The input string (hex): %s ", input); for(i = 0; i

length = strlen(binary_string); for(i=strlen(binary_string) - 12; i

printf("The binary string difference after each XOR step of the CRC calculation: "); i_line=0; if (strlen(chksm) % 4 == 0) { printf("The CRC computed for the input : "); for(i=0; i

CIS3360 Fall 2017 Integrity Checking Using CRC Author: [Your_name or names] The input string (hex): 5AE The input string (bin): 0101 1010 1110 The polynomial used (binary bit string): 1100 1101 1010 1 Mode of operation: calculation Number of zeroes that will be appended to the binary input: 12 The binary string difference after each XOR step of the CRC calculation: 0101 1010 1110 0000 0000 000 0011 1100 0011 0100 0000 0000 0000 1111 0101 11100000 0000 0000 0011 1000 0100 1000 0000 0000 0000 1011 0010 0010 0000 0000 0000 0111 1111 1000 1000 0000 0000 0001 1001 0101 1100 0000 0000 0000 0000 1110 1001 The CRC computed from the input: 0000 1110 1001 (bin) - 0E9 (hex)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Spatial And Temporal Databases 8th International Symposium Sstd 2003 Santorini Island Greece July 2003 Proceedings Lncs 2750

Authors: Thanasis Hadzilacos ,Yannis Manolopoulos ,John F. Roddick ,Yannis Theodoridis

2003rd Edition

3540405356, 978-3540405351

Students also viewed these Databases questions