# Implementing Checksum Method

2 Pages448 Words166 Views
|
|
|
BONUS ASSIGNMENT Write a program to implement the checksum method.The implementation has two parts:a.Calculating the checksum at the senderb.Verifying the checksum at the receiverCalculating the checksum at the senderInputs: 4 data each consisting of 16-bit (binary) Output: Checksum of 16-bit (binary)Example:http://mathforum.org/library/drmath/view/54379.htmlFor 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 0101First, 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"Therefore, the checksum generated from the given data would bePage 1 of 2

## End of preview

Want to access all the pages? Upload your documents or become a member.

Related Documents

### Support

#### +1 306 205-2269

Chat with our experts. we are online and ready to help.