0.2.2 • Published 9 years ago

jumphash v0.2.2

Weekly downloads
1,024
License
ISC
Repository
github
Last release
9 years ago

jumphash

Javascript implementation of jump consistent hash

For a faster node module see jumpsuit

Example

var jumphash = require('jumphash')

// jumphash(key, numBuckets)

// number keys - uses the floor of the absolute value
console.log(jumphash(23102, 16)) // 2

// buffer keys - uses the first 8 bytes as the key
console.log(jumphash(Buffer('1234567890ABCDEF', 'hex'), 1024)) // 888

// string keys - hashes the string with sha1
console.log(jumphash('live long and prosper', 256)) // 9

// optionally, specify a different string hash algorithm
console.log(jumphash('live long and prosper', 256, 'sha256')) // 82
0.2.2

9 years ago

0.2.1

9 years ago

0.2.0

9 years ago

0.1.0

9 years ago