All Projects → lovell → Farmhash

lovell / Farmhash

Licence: apache-2.0
Node.js implementation of FarmHash, Google's family of high performance hash functions

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Farmhash

Highwayhash
Node.js implementation of HighwayHash, Google's fast and strong hash function
Stars: ✭ 183 (-46.49%)
Mutual labels:  hash, checksum, fingerprint
Hashlib4pascal
Hashing for Modern Object Pascal
Stars: ✭ 132 (-61.4%)
Mutual labels:  hash, checksum
Gtkhash
A cross-platform desktop utility for computing message digests or checksums
Stars: ✭ 167 (-51.17%)
Mutual labels:  hash, checksum
Openhashtab
📝 File hashing and checking shell extension
Stars: ✭ 599 (+75.15%)
Mutual labels:  hash, checksum
bytes-java
Bytes is a utility library that makes it easy to create, parse, transform, validate and convert byte arrays in Java. It supports endianness as well as immutability and mutability, so the caller may decide to favor performance.
Stars: ✭ 120 (-64.91%)
Mutual labels:  checksum, hash
fingerprint-brunch
A brunch plugin for cache busting assets
Stars: ✭ 15 (-95.61%)
Mutual labels:  fingerprint, hash
JSum
Consistent checksum calculation of JSON objects.
Stars: ✭ 64 (-81.29%)
Mutual labels:  checksum, hash
fingerprint
Fingerprint is a simple tool that can be used to verify the contents of a directory.
Stars: ✭ 71 (-79.24%)
Mutual labels:  checksum, fingerprint
MalwareHashDB
Malware hashes for open source projects.
Stars: ✭ 31 (-90.94%)
Mutual labels:  hash
Grunt Filerev
[DEPRECATED] File revving
Stars: ✭ 261 (-23.68%)
Mutual labels:  hash
sha-2
SHA-2 algorithm implementations
Stars: ✭ 122 (-64.33%)
Mutual labels:  hash
notebook
此记事本包含了登录注册、指纹锁、检查更新、添加/查看记事,以及对已添加的记事进行编辑的功能
Stars: ✭ 27 (-92.11%)
Mutual labels:  fingerprint
Shortme
Yet Another URL Shortening Service in Golang
Stars: ✭ 269 (-21.35%)
Mutual labels:  hash
Checksum
Checksum calculation extensions for Swift
Stars: ✭ 28 (-91.81%)
Mutual labels:  checksum
Rxbiometric
☝️ RxJava and RxKotlin bindings for Biometric Prompt (Fingerprint Scanner) on Android
Stars: ✭ 295 (-13.74%)
Mutual labels:  fingerprint
CudaSHA256
Simple tool to calculate sha256 on GPU using Cuda
Stars: ✭ 38 (-88.89%)
Mutual labels:  hash
signet
Easily compare SHA/BLAKE2 sums.
Stars: ✭ 13 (-96.2%)
Mutual labels:  hash
Fingerprintjs
Browser fingerprinting library with the highest accuracy and stability.
Stars: ✭ 15,481 (+4426.61%)
Mutual labels:  fingerprint
Pluck to hash
Extend ActiveRecord pluck to return array of hashes
Stars: ✭ 275 (-19.59%)
Mutual labels:  hash
imprintjs
[INACTIVE] Javascript library for browser fingerprinting
Stars: ✭ 77 (-77.49%)
Mutual labels:  fingerprint

farmhash

Node.js implementation of Google's FarmHash family of very fast hash functions.

FarmHash is the successor to CityHash. Functions in the FarmHash family are not suitable for cryptography. A fast, cryptographically-secure alternative is HighwayHash.

As the V8 JavaScript engine only natively supports 32-bit unsigned integers, the 64-bit methods return strings instead of Numbers and the 128-bit methods are not implemented.

This module uses FarmHash v1.1.0 (2015-03-01). It has been tested with Node.js 10, 12 and 14 on Linux, OS X and Windows.

Pre-compiled binaries are provided for CPUs with SSE4.2 intrinsics. Use the npm install --build-from-source flag to gain performance benefits on more modern CPUs such as those with AVX intrinsics.

Installation

npm install farmhash
yarn add farmhash

Usage

const farmhash = require('farmhash');
const hash = farmhash.hash32('test');
console.log(typeof hash); // 'number'
const hash = farmhash.hash64(new Buffer('test'));
console.log(typeof hash); // 'string'
const hash = farmhash.hash64WithSeed('test', 123);
console.log(typeof hash); // 'string'
const hash = farmhash.fingerprint32(new Buffer('test'));
console.log(typeof hash); // 'number'
const hash = farmhash.fingerprint64('test');
console.log(typeof hash); // 'string'

API

Hash

The hash methods are platform dependent. Different CPU architectures, for example 32-bit vs 64-bit, Intel vs ARM, SSE4.2 vs AVX might produce different results for a given input.

hash32(input)

  • input is the Buffer or String to hash.

Returns a Number containing the 32-bit unsigned integer hash value of input.

hash32WithSeed(input, seed)

  • input is the Buffer or String to hash.
  • seed is an integer Number to use as a seed.

Returns a Number containing the 32-bit unsigned integer hash value of input.

hash64(input)

  • input is the Buffer or String to hash.

Returns a String representing the 64-bit unsigned integer hash value of input.

hash64WithSeed(input, seed)

  • input is the Buffer or String to hash.
  • seed is an integer Number to use as a seed.

Returns a String representing the 64-bit unsigned integer hash value of input.

hash64WithSeeds(input, seed1, seed2)

  • input is the Buffer or String to hash.
  • seed1 and seed2 are integer Numbers to use as seeds.

Returns a String representing the 64-bit unsigned integer hash value of input.

Fingerprint

The fingerprint methods are platform independent, producing the same results for a given input on any machine.

fingerprint32(input)

  • input is the Buffer or String to fingerprint.

Returns a Number containing the 32-bit unsigned integer fingerprint value of input.

fingerprint64(input)

  • input is the Buffer or String to fingerprint.

Returns a String representing the 64-bit unsigned integer fingerprint value of input.

Testing

Build Status

Build status

npm test

Licence

Copyright 2014, 2015, 2016, 2017, 2018, 2019, 2020 Lovell Fuller and contributors.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2014, 2015, 2016, 2017 Google, Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].