Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
sse4_crc32
Advanced tools
Starting 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.
The 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.
Below are the results from the 2 test cases:
> node benchmark
single fixed-size buffer, 10000 iterations:
- Native SSE 4.2 CRC-32C: 4.319142 ms
- Native Table-based CRC-32C: 10.726345 ms
- JavaScript (table-based) CRC-32C: 60.704765 ms
- JavaScript (direct) CRC-32C: 336.376904 ms
multiple random-length buffers, 10000 iterations:
- Native SSE 4.2 CRC-32C: 60.194043 ms
- Native Table-based CRC-32C: 225.459861 ms
- JavaScript (table-based) CRC-32C: 1786.079168 ms
- JavaScript (direct) CRC-32C: 12307.033387 ms
Use the following command to install the library from npm:
npm install --save sse4_crc32
Import the module:
const Sse4Crc32 = require("sse4_crc32")
Calculate the 32-bit CRC for any string:
const crc = Sse4Crc32.calculate("my string")
Instead 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.
const crc = Sse4Crc32.calculate("my string")
const newCrc = Sse4Crc32.calculate("my new string", crc)
You can also calculate the CRC for streams, as follows:
const stream = Sse4Crc32
.fromStream(fs.createReadStream('/path/to/file'))
.on('finish', () => console.log(`CRC-32C: ${stream.crc}`))
Once the repository has been cloned, use one of the following commands to build the library:
make all // Builds the release version of the library and runs all tests
make debug // Builds the debug version of the library
make clean // Removes all files generated by builds
All feedback/suggestions/criticisms can be directed to Anand Suresh
FAQs
Hardware-accelerated CRC-32C with software fallback
We found that sse4_crc32 demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.