Skip to content

v1.2

@rtobar rtobar tagged this 03 Nov 02:10
This version changes the behavior of the crc32 method, making it easier
for users to start using it (they don't need to specify an initial value
of 0xffffffff) and to get the final checksum value (they don't need to
XOR the value with 0xffffffff after the final call).

This is achieved by the same trick used by other crc32 methods:
 * The default value for the crc parameter is 0
 * The crc value is XORed with 0xffffffff, thus yielding 0xffffffff for
   the initial register value.
 * The final register value is XORed with 0xffffffff, taking this
   responsibility away from the user.
 * If the method is called in a loop with adjacent chunks of a message
   (e.g., crc32('def', crc32('abc')) for message 'abcdef'), the crc
   from the first call will effectively pass through two XORs with
   0xffffffff, and thus the internal checksum loop will proceed with the
   correct value.

Signed-off-by: Rodrigo Tobar <[email protected]>
Assets 2