🌀 JS standard CRC-32 and CRC32C implementation https://cdn.sheetjs.com/crc-32/
Go to file
SheetJSDev 606138a7e9 Merge pull request #1 from Mithgol/patch-1
use SVG to display Travis CI build testing status
2014-06-17 02:36:17 -04:00
bits Initial commit 2014-06-16 17:27:47 -04:00
ctest Initial commit 2014-06-16 17:27:47 -04:00
misc added spin.sh 2014-06-16 17:55:48 -04:00
perf Initial commit 2014-06-16 17:27:47 -04:00
.gitignore Initial commit 2014-06-16 17:27:47 -04:00
.jscs.json Initial commit 2014-06-16 17:27:47 -04:00
.travis.yml Initial commit 2014-06-16 17:27:47 -04:00
crc32.js Initial commit 2014-06-16 17:27:47 -04:00
LICENSE Initial commit 2014-06-16 17:27:47 -04:00
Makefile Initial commit 2014-06-16 17:27:47 -04:00
package.json Initial commit 2014-06-16 17:27:47 -04:00
README.md use SVG to display Travis CI build testing status 2014-06-17 10:30:04 +04:00
test.js Initial commit 2014-06-16 17:27:47 -04:00

crc32

Standard CRC-32 algorithm implementation in JS (for the browser and nodejs). Emphasis on correctness and performance.

Installation

In nodejs:

npm install crc-32

In the browser:

<script lang="javascript" src="crc32.js"></script>

The browser exposes a variable CRC32

Usage

  • CRC32.buf(byte array or buffer) assumes the argument is a set of 8 bit unsigned integers (e.g. nodejs Buffer or simple array of ints)

  • CRC32.bstr(binary string) interprets the argument as a binary string where the i-th byte is str.charCodeAt(i)

  • CRC32.str(string) interprets the argument as a standard JS string

Testing

make test will run the nodejs-based test. To run the in-browser tests, run a local server and go to the ctest directory. To update the browser artifacts, run make ctest.

Performance

make perf will run performance tests.

Unexpected code patterns were based on performance testing in node and browser:

In the future ...

  • Specifying an arbitrary initial CRC value

  • Supporting different polynomials (e.g. CRC32C)

License

Please consult the attached LICENSE file for details. All rights not explicitly granted by the Apache 2.0 license are reserved by the Original Author.

Build Status

Coverage Status

githalytics.com alpha