buffer-crc32

crc32 that works with binary data and fancy character sets, outputs
buffer, signed or unsigned data and has tests.
Derived from the sample CRC implementation in the PNG specification: http://www.w3.org/TR/PNG/#D-CRCAppendix
install
npm install buffer-crc32
example
var crc32 = require('buffer-crc32');
var buf = Buffer([0x00, 0x73, 0x75, 0x70, 0x20, 0x62, 0x72, 0x6f, 0x00])
crc32(buf)
crc32.signed(buf)
crc32.unsigned(buf)
crc32('自動販売機')
var partialCrc = crc32('hey');
var partialCrc = crc32(' ', partialCrc);
var partialCrc = crc32('sup', partialCrc);
var partialCrc = crc32(' ', partialCrc);
var finalCrc = crc32('bros', partialCrc);
tests
This was tested against the output of zlib's crc32 method. You can run
the tests withnpm test
(requires tap)
see also
https://github.com/alexgorbatchev/node-crc, crc.buffer.crc32
also
supports buffer inputs and return unsigned ints (thanks @tjholowaychuk).
license
MIT/X11