This is going probably be a general question regarding checksum used for error detection.
I got a lab assignment where we are going to recreate a protocol similar to how RDT2.0 works. And I’m stuck in how to use checksum to detect errors.
The functions are there already what I need is to implement the functionality.
What I don’t understand is how you can know that a pack is corrupted.
E.g.
I’m going to send over a text file. So I have some function which will take a number of bytes and store it in an object where I’ll also attach a header with the checksum.
So if this package will be corrupted now I have no where to tell it has happent since the checksum will also be changed right?
So can anyone tell me how I should use the checksum?
The checksum might have been changed, but the chances of it being changed to match the checksum of the changed content are slim.
So, when you read the package, you calculate a new checksum for the content and compare it to the checksum stored in the package. If they match, there is no corruption, if not, something was changed (either the content, the checksum, or both).