Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

************NEED HELP ASAP************ ************IN C LANGUAGE************** Calculating CRC Values You will need to calculate CRC values in both modes of operation. In calculate mode, the

************NEED HELP ASAP************

************IN C LANGUAGE**************

Calculating CRC Values

You will need to calculate CRC values in both modes of operation. In calculate mode, the value calculated is the final output. In verify mode, you must take one additional step, which is to compare the CRC value that you calculate against the value that is observed from the input string to determine whether the observed value is correct.

You should use the CRC calculation method we discussed in lecture, since this will produce the intermediate result strings that your program must output. Moreover, you should use arrays of characters, strings, or boolean values to hold the polynomial and the input string, since the input string can be as long as 40 hex characters (160 bits) and you will need to add 12 additional zero values as padding to start off the computation. You cannot use a long integer value for this program since 40 hex characters represent 160 bits and a long integer is only 64 bits.

Java programmers are warned (here, for the second time; see Programming Language section above) not to use Java's BigInteger class -- you will receive a zero for this assignment if you do. You should use arrays of characters, strings, or boolean values and perform the calculations as we have described them in lecture.

The method discussed in lecture is illustrated using the following example in which we will compute the CRC-4 code for the message 5AE, using the polynomial x4 + x2 + 1. This is only a simple example, to illustrate the procedure. For the program that you must write, you will need to calculate CRC-12 values a well as perform verification as described.

To begin, we convert the polynomial for this example to the 5-bit string 10101. Next, we convert the input string 5AE to its binary equivalent, 010110101110. Next, we pad input value with 4 zeroes at the right since we are performing CRC-4 in this example, producing the value 0101101011100000, which is called thedividend. This is the value that we will divide by the polynomial. The remainder that we get from this division will be the desired CRC-4 value.

You will recall that to perform the binary division, we use the XOR operation for the subtraction part. We apply the XOR operator separately on each bit position involved in the subtraction. Other than the use of XOR, the division is performed in exactly the same way as long division for base 10 numbers.

The following table illustrates the division method we discussed in lecture. In the table, the dividend (padded input string) is shown in blue, the polynomial divisor is shown in red, and the results of the XOR operations are shown on the lines that do not have the XOR symbol at the left edge. The CRC value is the remainder, 1110, shown in red at the bottom. We show this binary value and express it equivalently as the hex character E.

image text in transcribed

Your program will need to output the results of each XOR operation in a format that contains the same number of bits for every result. The number of bits we wish to use in this example is 16, which is computed from the length of the binary input (3 hex characters = 12 bits), plus the number of pad characters (here, 4). So, we need to report the results of the XOR operations as 16-bit binary numbers. The way we will do this is to add leading zeroes to the left of each XOR result and to bring down the unused bits from the dividend to the right.

This is illustrated in the following table, which shows the same division calculation as above, only with the desired 16-bit output lines shown in bold. Please note that the first output value is simply the dividend (which includes the padding). The polynomial divisor is reported separately and is not included in the table of XOR operation results.

image text in transcribed

2 1 0 10 1 11 01 1010 1 1 000 1 1 0101 1 0 010 1 010 1 1 1 100 1 0 010 1 0 101 1 110

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

Step: 3

blur-text-image

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

Transact SQL Cookbook Help For Database Programmers

Authors: Ales Spetic, Jonathan Gennick

1st Edition

1565927567, 978-1565927568

More Books

Students also viewed these Databases questions

Question

13-6 How will MIS help my career?

Answered: 1 week ago