0

enter image description here

How would I compute the 8-bit internet checksum of this data?

From what I've found so far, to compute the checksum you would add the sums of each of the data parts and then use the 1st compliment on this result sum. But when I try this I get:

00000011 + 00000100 = 00000111(x = 3 + 4)

00000111 + 00000101 = 00001100(y = x + 5)

00001100 + 00000110 = 00010010(y + 6)

Applying the 1st compliment would get me: 11101101 which is not the correct result comparing with what is expected above.

Is my method approaching this calculation wrong?

NewDev90
  • 379
  • 2
  • 21
  • How do you know the result should be `00101101`? Please [edit] your question to include the source of that statement, maybe the link to the assignment itself. Also, the result of your addition should be `00010010` (binary for 18). – Progman Dec 30 '19 at 14:43
  • @Progman it's an assignment provided with an exercise set, as part of my education. – NewDev90 Dec 30 '19 at 14:44
  • Please add the assignment itself or a link to the assignment to your question so it can be checked. – Progman Dec 30 '19 at 14:46
  • @Progman It's part of a previous exam set provided by a lecturer, thus, it contains no calculations but the end result as provided above. I am however, interested in the actual computation of the checksum, which is what this post concerns, and whether the method I imply is right or wrong, since I clearly get something different. – NewDev90 Dec 30 '19 at 14:48
  • Please add the actual assignment text to your question (or a link to the assignment), so we see the assignment and the information available from that assignment. It's curios that the first bits of the solution is `00`, because `11101101` would make more sense. – Progman Dec 30 '19 at 14:58
  • @Progman I included the assignment text above (similar to what I wrote) – NewDev90 Dec 30 '19 at 15:01

1 Answers1

1

Digits 3-6 is 0x33-0x36 in ASCII.

0x33 + 0x34 + 0x35 + 0x36 = 0xd2 = 0b11010010 Applying 1st compliment you get 0b00101101 which is what the provided result should be.

So basically your calculations were good but you should have used the ASCII codes of the numbers, not the numbers themselves.

h3yduck
  • 1,571
  • 14
  • 14
  • Ah that makes sense to me thanks. In my case I did not consider that would influence the result. Thanks for showing! – NewDev90 Dec 30 '19 at 15:03