bling-hashes
String hash algorithms.
Last updated 5 years ago by xadillax .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install bling-hashes 
SYNC missed versions from official npm registry.

Bling Hashes

bling-hashes bling-hashes Build Status Coverage Status License Dependency Status

Star at GitHub

String hash algorithms for node.js.

Installation

$ npm install --save bling-hashes

Introduce

There are 8 algorithms so far.

The benchmark, performance and implementation can be referenced here (各种字符串Hash函数比较).

Usage

First you should require this package.

var bling = require("bling-hashes");

And then you can pass any string to functions (the same name as algorithms, in lowercase).

Eg.

var hash1 = bling.bkdr("Hello world!"); ///< 501511565
var hash2 = bling.city32("玉扣"); ///< 887335438

Return Values

  • From BKDR to ELF, the functions return a Number value;
  • city32 returns a Number value too;
  • city64 returns a Long value which may refer here;
  • city128 returns a City128Value value which has properties below:
    • .toString(): The string value of the 128-bit number;
    • .toLongArray(): An array that includes two 64-bit Long value;
    • .toBuffers(): An array that includes two Buffers.
    • .toBigNumber(): A BigNumber value which may refer here;

Contribution

Thanks to BYVoid. The C++ implementation code was copied from his blog.

You're welcome to make pull requests.

「雖然我覺得不怎麼可能有人會關注我」

Current Tags

  • 2.0.0                                ...           latest (a year ago)

6 Versions

  • 2.0.0                                ...           a year ago
  • 1.2.0                                ...           2 years ago
  • 1.1.1                                ...           5 years ago
  • 1.1.0                                ...           5 years ago
  • 1.0.1                                ...           5 years ago
  • 1.0.0                                ...           5 years ago
Maintainers (1)
Downloads
Today 6
This Week 54
This Month 224
Last Day 0
Last Week 60
Last Month 164
Dependencies (2)
Dev Dependencies (4)
Dependents (3)

Copyright 2014 - 2016 © taobao.org |