Question: hello, I have bouns assignment in programming the following, help me in my assignment with explanation please. regards.. Write a program to implement the checksum
hello, I have bouns assignment in programming the following, help me in my assignment with explanation please.
regards..
Write a program to implement the checksum method. The implementation has two parts: a. Calculating the checksum at the sender b. Verifying the checksum at the receiver Calculating the checksum at the sender Inputs: 4 data each consisting of 16-bit (binary) Output: Checksum of 16-bit (binary)
Example: http://mathforum.org/library/drmath/view/54379.html
For example, suppose we have the following data. I separate the data into groups of 4 bits only for readability.
1000 0110 0101 1110
1010 1100 0110 0000
0111 0001 0010 1010
1000 0001 1011 0101
First, we add the 16-bit values 2 at a time: 1000 0110 0101 1110 First 16-bit value + 1010 1100 0110 0000 Second 16-bit value --------------------- 1 0011 0010 1011 1110 Produced a carry-out, which gets added + \----------------> 1 back into LSb --------------------- 0011 0010 1011 1111 + 0111 0001 0010 1010 Third 16-bit value --------------------- 0 1010 0011 1110 1001 No carry to swing around (**) + 1000 0001 1011 0101 Fourth 16-bit value --------------------- 1 0010 0101 1001 1110 Produced a carry-out, which gets added + \----------------> 1 back into LSb --------------------- 0010 0101 1001 1111 Our "one's complement sum"
(**) Note that we could "swing around" the carry-out of 0, but adding 0 back into the LSb has no effect on the sum. (But technically, that's what the checksum generator does.) Then we have to take the one's complement of the sum. We do this by simply inverting all the bits in the final result from above:
0010 0101 1001 1111 Our "one's complement sum" 1101 1010 0110 0000 The "one's complement" Page 2 of 2 Therefore, the checksum generated from the given data would be 1101 1010 0110 0000. Verifying the checksum at the receiver Inputs: 4 data each is consisting of 16-bit and their 16-bit checksum Output: Checksum for 4 data each is consisting of 16-bit and their 16-bit checksum If checksum is equal to 0s, your data is not corrupted If checksum is not equal 0s, your data is corrupted.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
