
Security News
Crates.io Implements Trusted Publishing Support
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
node-clhash
Advanced tools
Node.js library that provides bindings for the CLHash C library (https://github.com/lemire/clhash).
⚠️ The package compilation requirements are the same as the CLHash library requirements (see https://github.com/lemire/clhash#requirements).
To install the package run the following command:
$ npm install node-clhash
# Or if you use yarn
$ yarn add node-clhash
The get_random_key_for_clhash
uses posix_memalign
internally and needs to be the key pointer to be aligned. The library does not expose binding for the get_random_key_for_clhash
and doesn't allow the user to generate its key. Instead, it generates the key and then the hashed value and returns both values to the user:
const { clhash } = require('node-clhash');
// Generate synchronously.
const { key, hashed } = clhash.sync('my long string');
console.log({ key, hashed }); // { key: 5067639175440424385n, hashed: 8451564168848164053n }
// Generate asynchronously.
clhash('my long string', (error, { key, hashed }) => {
console.log({ key, hashed }); // { key: 5067639175440424385n, hashed: 8451564168848164053n }
});
The key
and hashed
values are BigInt
. The clhash
returns uint64_t
, which is unsigned long long
. The maximum uint64_t
value is 2 ^ 64 - 1
and the maximum JavaScript integer value is 2 ^ 53 - 1
(Number.MAX_SAFE_INTEGER
).
FAQs
Bindings for the CLHash C API to the Node.js world
The npm package node-clhash receives a total of 6 weekly downloads. As such, node-clhash popularity was classified as not popular.
We found that node-clhash 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
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
Research
/Security News
Undocumented protestware found in 28 npm packages disrupts UI for Russian-language users visiting Russian and Belarusian domains.
Research
/Security News
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.