With longer inputs, previous crc-32 can give signed (negative) results,
which are incorrect. This patch shifts the result right-wise, filling in
the left with zeros, to ensure the result is unsigned (unlike the C++
implementation, JS lacks a standard unsigned type).
I used OS X's "cksum -o3" command to get the expected CRC-32 output for
the test file.
This is a pretty dumb way of forcing the result to be unsigned - if there's a
better approach, feel free to change this.
With longer inputs, previous crc-32 can give signed (negative) results, which are incorrect. This patch shifts the result right-wise, filling in the left with zeros, to ensure the result is unsigned (unlike the C++ implementation, JS lacks a standard unsigned type).
I used OS X's "cksum -o3" command to get the expected CRC-32 output for the test file.
This is a pretty dumb way of forcing the result to be unsigned - if there's a better approach, feel free to change this.