Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

farmhash

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

farmhash

Node.js implementation of FarmHash, Google's family of high performance hash functions for strings

  • 0.2.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
207K
decreased by-6.97%
Maintainers
1
Weekly downloads
 
Created

What is farmhash?

The farmhash npm package provides fast, non-cryptographic hash functions for strings and binary data. It is based on Google's FarmHash family of hash functions, which are designed for high performance and reliability.

What are farmhash's main functionalities?

Hashing a string

This feature allows you to generate a 32-bit hash from a given string. The hash function is optimized for speed and can be used for tasks like data partitioning or quick lookups.

const farmhash = require('farmhash');
const hash = farmhash.hash32('Hello, world!');
console.log(hash);

Hashing a buffer

This feature allows you to generate a 32-bit hash from a buffer. This is useful for hashing binary data or files.

const farmhash = require('farmhash');
const buffer = Buffer.from('Hello, world!');
const hash = farmhash.hash32(buffer);
console.log(hash);

Hashing a string to 64-bit

This feature allows you to generate a 64-bit hash from a given string. The 64-bit hash provides a larger hash space, reducing the likelihood of collisions.

const farmhash = require('farmhash');
const hash = farmhash.hash64('Hello, world!');
console.log(hash);

Hashing a buffer to 64-bit

This feature allows you to generate a 64-bit hash from a buffer. This is useful for applications requiring a larger hash space for binary data.

const farmhash = require('farmhash');
const buffer = Buffer.from('Hello, world!');
const hash = farmhash.hash64(buffer);
console.log(hash);

Other packages similar to farmhash

Keywords

FAQs

Package last updated on 03 Jan 2015

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc