Socket
Socket
Sign inDemoInstall

node-clhash

Package Overview
Dependencies
1
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    node-clhash

Bindings for the CLHash C API to the Node.js world


Version published
0
Maintainers
1
Created
Weekly downloads
 

Readme

Source

node-clhash

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).

Keywords

FAQs

Last updated on 10 May 2022

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc