{"name":"sse4_crc32","description":"Hardware-accelerated CRC32 based on Intel Streaming SIMD Extensions 4.2","keywords":["crc","crc32","crc32c","sse","sse4","sse4.2","error detection"],"version":"2.1.2","author":{"name":"Anand Suresh","email":"anandsuresh@gmail.com","url":"https://github.com/anandsuresh"},"licenses":[{"type":"MIT"}],"repository":{"type":"git","url":"https://github.com/anandsuresh/sse4_crc32"},"bugs":{"url":"https://github.com/anandsuresh/sse4_crc32/issues"},"engines":{"node":">=0.8.16"},"main":"./sse4_crc32","dependencies":{"node-gyp":"^1.0.2","bindings":"~1.2.1","nan":"^1.6.0"},"devDependencies":{"tap":">=0.4.0","crc32":">=0.2.1"},"scripts":{"test":"tap test/*test.js","install":"node-gyp rebuild"},"gypfile":true,"gitHead":"6a26e1d3b09f028da9b86e0ecd7c195866764110","homepage":"https://github.com/anandsuresh/sse4_crc32","_id":"sse4_crc32@2.1.2","_shasum":"5619927a52645205c95a38b216511ee7aa6e7108","_from":".","_npmVersion":"2.1.8","_nodeVersion":"0.10.33","_npmUser":{"name":"anandsuresh","email":"anandsuresh@gmail.com"},"maintainers":[{"name":"anandsuresh","email":"anandsuresh@gmail.com"}],"dist":{"shasum":"5619927a52645205c95a38b216511ee7aa6e7108","tarball":"http://registry-npm.ywwl.com/sse4_crc32/download/sse4_crc32-2.1.2.tgz","integrity":"sha512-LWQycdVVTIvyZuzhv5uQipNjEWyjyqUqGUvEj7PdmEkAA/BBpfr9vtwyGK0LbUHSxEwuXDkvdSAPepZupOq9Rw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDB7ZwBhgyGSNFFqJhB7zFj5rLXPQvLkDF64hcyYXqxAQIga6TYcQl0EpnaP5otX8b4v/+0nC52hdz9YDfTfJ/4xpE="}],"size":6407,"noattachment":false,"key":"/sse4_crc32/-/sse4_crc32-2.1.2.tgz"},"directories":{},"readme":"# sse4-crc32\n\n[![node (scoped)](https://img.shields.io/node/v/sse4_crc32.svg?style=plastic)](https://nodejs.org/en/download/)\n[![npm (scoped)](https://img.shields.io/npm/v/sse4_crc32.svg?style=plastic)](https://www.npmjs.com/package/sse4_crc32)\n[![npm](https://img.shields.io/npm/dt/sse4_crc32.svg?style=plastic)](https://www.npmjs.com/package/sse4_crc32)\n[![Travis](https://img.shields.io/travis/anandsuresh/sse4_crc32.svg?style=plastic)](https://travis-ci.org/anandsuresh/sse4_crc32)\n[![license](https://img.shields.io/github/license/anandsuresh/sse4_crc32.svg?style=plastic)](LICENSE)\n[![GitHub followers](https://img.shields.io/github/followers/anandsuresh.svg?style=social&label=Follow)](https://github.com/anandsuresh)\n[![Twitter Follow](https://img.shields.io/twitter/follow/anandsuresh.svg?style=social&label=Follow)](https://twitter.com/intent/follow?screen_name=anandsuresh)\n\nStarting with the Nehalam series, Intel processors feature the Streaming SIMD Extensions instruction set which provide a hardware-accelerated version of the CRC-32 algorithm (Castagnoli variant). This library uses the Intel SSE 4.2 instruction set to provide a fast CRC-32C implementation.\n\n## features\n\n- Intel Streaming SIMD Extensions 4.2 based hardware-accelerated CRC-32C calculation\n- Graceful fallback to software-based CRC-32C (table-based CRC calculation)\n- Supports streams, strings and buffers\n\n## performance\n\nThe tests were run on a Macbook Air running an Intel Core i7 processor, with 16GB of RAM and used buffers instead of strings to prevent having items on the V8 heap that might cause the garbage collector to fire frequently and interfere with the test run-times.\n\nBelow are the results from the 2 test cases:\n\n``` bash\n> node benchmark\n\nsingle fixed-size buffer, 10000 iterations:\n- Native SSE 4.2 CRC-32C: 4.319142 ms\n- Native Table-based CRC-32C: 10.726345 ms\n- JavaScript (table-based) CRC-32C: 60.704765 ms\n- JavaScript (direct) CRC-32C: 336.376904 ms\n\n\nmultiple random-length buffers, 10000 iterations:\n- Native SSE 4.2 CRC-32C: 60.194043 ms\n- Native Table-based CRC-32C: 225.459861 ms\n- JavaScript (table-based) CRC-32C: 1786.079168 ms\n- JavaScript (direct) CRC-32C: 12307.033387 ms\n```\n\n## installation\n\nUse the following command to install the library from npm:\n\n``` bash\nnpm install --save sse4_crc32\n```\n\n## usage\n\nImport the module:\n\n``` javascript\nconst Sse4Crc32 = require(\"sse4_crc32\")\n```\n\nCalculate the 32-bit CRC for any string:\n\n``` javascript\nconst crc = Sse4Crc32.calculate(\"my string\")\n```\n\nInstead of passing in a string, a buffer can be passed to the `calculate()` function. Furthermore, the `calculate()` function takes an optional `initialCrc` value as the second argument, allowing for progressive CRC calculation.\n\n``` javascript\nconst crc = Sse4Crc32.calculate(\"my string\")\nconst newCrc = Sse4Crc32.calculate(\"my new string\", crc)\n```\n\nYou can also calculate the CRC for streams, as follows:\n\n``` javascript\nconst stream = Sse4Crc32\n  .fromStream(fs.createReadStream('/path/to/file'))\n  .on('finish', () => console.log(`CRC-32C: ${stream.crc}`))\n```\n\n## how to compile\n\nOnce the repository has been cloned, use one of the following commands to build the library:\n\n``` bash\nmake all            // Builds the release version of the library and runs all tests\nmake debug          // Builds the debug version of the library\nmake clean          // Removes all files generated by builds\n```\n\n## contact\n\nAll feedback/suggestions/criticisms can be directed to [Anand Suresh](http://www.github.com/anandsuresh)\n","publish_time":1423264893021,"_cnpm_publish_time":1423264893021,"dist-tags":{"latest":"7.0.0"}}