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.
CRC32C C implementation for Linux. Supports strings, String Objects and Buffers!
Basic C modules for NodeJS with crc32c (Castagnoli) implementation for Linux. The implementation uses the native Linux library "AF_ALG". It is compatible with node 0.10 and 0.11!
It supports strings, string objects, buffers, numbers! Works well with mongoose. Just do a toString on the entity to hash!
This module is not meant for secure hashing but really for something like ETags or anything that is easier to compare using a hash than the full string.
##Building
make build
or
npm install crc32c
##Usage
You have the function compute
, which takes only one argument, the string to hash.
From JavaScript:
var crc32c = require('crc32c');
// Works with strings!
var toHash = "HELLOWORLD";
console.log(crc32c.compute(toHash));
// Or buffers!
console.log(crc32c.compute(new Buffer('{"jsonString":"property1","jsonArray":["arr1","arr2","arr3"]}')));
// Or String Objects!
console.log(crc32c.compute(new String('A superb string!')));
// It also supports numbers, if you really need to compute on a single integer/float!
console.log(crc32c.compute(3.141592654);
With >100 iterations I get a 3x to 5x performance improvements. It really shows up at more than 10K iterations though.
You have to create an object called a Batcher. This object then has 3 methods: openSocket
, closeSocket
, and compute
.
From JavaScript:
var crc32c = require('crc32c');
var Batcher = new crc32c.Batcher(); // You can create as many as you want. Every instance will use a single socket.
var Batcher.openSocket();
console.log(Batcher.compute(new Buffer('{"jsonString":"property1","jsonArray":["arr1","arr2","arr3"]}')));
// ... Iterate on many strings/buffer/etc.
Batcher.closeSocket();
From cli:
crc32c <filename>
It currently supports only one file at the time.
SOON See the example sections!
##License
The plugin is under MIT license, please see the LICENSE file provided with the module.
You can run the test by doing make test
. Currently the test only contains successful use case, but error handling test cases will be added soon.
Run the script by doing make benchmarks
!
I think that pure times are not representative of reality, since every setup will get different results. This is why I've put the times in ratio using AF_ALG batch as the base (1).
For the original times see benchmarks/results.txt
Test | AF_ALG batch | AF_ALG std | SSE4.2 | Pure JS (table) | Pure JS (direct) |
---|---|---|---|---|---|
TEST_STRING_1024 | 1 | 4.4 | 0.3 | 60.4 | 97.4 |
TEST_STRING_2048 | 1 | 4.6 | 0.4 | 119.8 | 186.9 |
TEST_BUFFER_1024 | 1 | 5.7 | 0.4 | 8.9 | 45.5 |
TEST_BUFFER_2048 | 1 | 5.2 | 0.5 | 95.0 | 86.5 |
TEST_STRING_OBJECT_1024 | 1 | 3.5 | N/A | 50.6 | 115.8 |
TEST_STRING_OBJECT_2048 | 1 | 3.3 | N/A | 103.9 | 208.6 |
N/A means that it is not available because not supported.
0.6.0
FAQs
CRC32C C implementation for Linux. Supports strings, String Objects and Buffers!
We found that crc32c demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.