Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask C/C++ Expert


Home >> C/C++

problem 1) prepare the program which compute the CRC-16 value for a given file and also verifies the correctness of a given file that already has CRC-16 value appended at the end, as more fully described below.

Use the CRC polynomial x^(16) + x^(11) + x^(8) + x^(7) + x^(3) + x^(2) + 1.

Program operation:

1) The program should compile from the command line.

2) The program executable file name must be “crcfile”.

3) The program should run from the command line and take two (2) command line parameters.

4) The first command line parameter would be a flag value which identifies the mode of operation: “c” for calculating a CRC value, or “v” for verifying a CRC value. Only these two values are allowed. Any other values must produce a simple error message and a graceful exit from the program.

5) The second command line parameter would be the name of the file to be examined. The file must be a text file that is in the same folder as the program executable. If the file is not found, the program must issue a simple error message and exit gracefully.

6) The program must direct all output to the command window (terminal) screen. The details of what to output are describeed below.
Specific Functions inside code:

You should implement the following functions/methods:

• A function/method for converting a hexadecimal string into binary string

• A function/method for converting a binary string to hexadecimal

• A function/method to validate the characters in the input file

• An XOR function/method that takes as input two binary strings and returns the XOR result.

• A function/method for CRC calculation

• A function/method for CRC verification

Input file format:

Create YOUR OWN VALID input file.

Valid input files would be text files which contain only hexadecimal characters. Either upper or lower case letters may appear, but they would only be letters which correspond to hexadecimal characters. There would be no whitespace, punctuation, or special characters in the input files.

You should check for input correctness by implementing code to verify that each character in the input file is a valid hexadecimal character (0,1,2,3,4,5,6,7,8,9A,B,C,D,E,F,a,b,c,d,e,f). Valid upper and lower case hex letters will be given the same meaning (“a” = “A” = 1010, etc.)
If an input file contains any invalid characters (other than an end-¬?of-¬?file marker), then the program should issue an appropriate brief error message and terminate gracefully.

Output format:

Print out the hexadecimal file that is read, 80 hex characters to a line.

Next, you should convert the hexadecimal file into binary. Recall that one hex character is four bits. Read the input file and form a binary string. The length of the binary string will be four times the length of the input file because each hexadecimal character will be replaced by 4 binary bits. You will have to define a separate function to get the binary equivalent of a hexadecimal character.

You must state how many zeroes are appended to the input. You must then print the binary version of the input file (after appending) 64 binary bits per line. You must also insert a space after every four binary bits that you print (increasing the line length to 80 characters).

Next, you will show the result of each XOR operation involved in the CRC calculation or verification. The result value at each step is a binary value that contains all of the digits of the dividend after an XOR operation.

C/C++, Programming

  • Category:- C/C++
  • Reference No.:- M94600

Have any Question?


Related Questions in C/C++

1 implement the binary search tree bst in c using the node

1. Implement the Binary Search Tree (BST) in C++, using the Node class template provided below. Please read the provided helper methods in class BST, especially for deleteValue(), make sure you get a fully understanding ...

What are the legal requirements with which websites must

What are the legal requirements with which websites must comply in order to meet the needs of persons with disabilities? Why is maximizing accessibility important to everyone?

Why do researcher drop the ewaste and where does it end

Why do researcher drop the ewaste and where does it end up?

Assign ment - genetic algorithmin this assignment you will

ASSIGN MENT - GENETIC ALGORITHM In this assignment, you will use your C programming skills to build a simple Genetic Algorithm. DESCRIPTION OF THE PROGRAM - CORE REQUIREMENTS - REQ1: Command-line arguments The user of yo ...

Assignment word matchingwhats a six-letter word that has an

Assignment: Word Matching What's a six-letter word that has an e as its first, third, and fifth letter? Can you find an anagram of pine grave. Or how about a word that starts and ends with ant (other than ant itself, of ...

Project - space race part a console Project - Space Race Part A: Console Implementation

Project - Space Race Part A: Console Implementation INTRODUCTION This assignment aims to give you a real problem-solving experience, similar to what you might encounter in the workplace. You have been hired to complete a ...

Software development fundamentals assignment 1 -details amp

Software Development Fundamentals Assignment 1 - Details & Problems - In this assignment, you are required to answer the short questions, identify error in the code, give output of the code and develop three C# Console P ...

Question 1find the minimum and maximum of a list of numbers

Question: 1. Find the Minimum and Maximum of a List of Numbers: 10 points File: find_min_max.cpp Write a program that reads some number of integers from the user and finds the minimum and maximum numbers in this list. Th ...

There are several ways to calculate the pulse width of a

There are several ways to calculate the pulse width of a digital input signal. One method is to directly read the input pin and another method (more efficient) is to use a timer and pin change interrupt. Function startTi ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As