You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi @DonBrinn, I believe this is the expected behavior. The default initial value for CRC32 is 0xFFFFFFFF, which is -1. This could be verified over at http://www.sunshine2k.de/coding/javascript/crc/crc_js.html for example. CRC32 of helloworld is 0xF9EB20AD with default CRC32 Initial Value of 0xFFFFFFFF. Changing initial value to 0 produces 0xE59EB724.
I've also verified this with Ruby:
require'zlib'puts("no initial value : #{(Zlib::crc32('helloworld')).to_s(16)}")puts("with initial value : #{Zlib::crc32('world',Zlib::crc32('hello')).to_s(16)}")
>
noinitialvalue : f9eb20adwithinitialvalue : f9eb20ad
The same output is produced by node-crc CRC32 function:
Consider the following:
A seed value of
0
should be treated the same as no seed value (i.e seed valueundefined
).2768625435
is the value that should be returned from the call tocrc32([1], 0)
.The text was updated successfully, but these errors were encountered: