c - Does the complement have any impact on Fletcher's checksum? -
the wikipedia article fletcher's checksum states:
these examples assume two's complement arithmetic, fletcher's algorithm incorrect on one's complement machines.
this question provides scan book says:
addition performed modulo 255 (1's complement arithmetic)
fletcher's checksum uses running sum, don't see need negative numbers, , aim identify differences, long same number system (one's complement, two's complement, neither) used on checking system matter? examples given on wikipedia page specify unsigned integer types too.
i've tagged c examples given on wikipedia page in c perhaps has bearing in this. i'm not mathematician , barely competent programmer it's quite possible there blindingly obvious reason why complement have impact.
any insight grateful received.
the number system matters lot.
although fletcher's checksum works using both two's complement arithmetic (integer computations modulo 256) , one's complement arithmetic (integer computations modulo 255), resulting algorithms have different error-detection properties. one's complement version has minimum separation of undetected double bit errors of 2040 bits while two's complement has minimum separation of 16 bits (table 1 in paper).
therefore, fletcher explicitely recommends against using two's complement version.
Comments
Post a Comment