CRC in C++
Go to solution
Solved by AbydosOne,
39 minutes ago, BuckGup said:Would this be an example of CRC
No, it's a checksum. Not as comprehensive as a CRC, but can detect a change in data (but is not reliable).
39 minutes ago, BuckGup said:If so could someone explain what the sum & hex portion does.
Count (I assume) is the size (in bytes?) of the frame to check. For each [data_unit] (byte?) until count equals 0, it adds the [value at frame] to the sum and increments *frame.
If the sum overflows a 16-bit value (larger than 0xFFFF), it truncates the output back to 16-bits (using bitwise AND of 0xFFFF). This could probably be simplified by setting sum to a smaller datatype (u_int16?), but I'm not sure how those handle the overflowing.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now