0.0.1 • Published 9 years ago

pearson v0.0.1

Weekly downloads
1
License
MIT
Repository
github
Last release
9 years ago

node-pearson-hash

The Pearson hashing function, for node.js / io.js

Getting it

npm install pearson

Using it

The Pearson hashing function relies on a permutation of the integers from 0 to 255. I will hereafter call this permutation the "seed".

var pearson = require('pearson');

//To generate a seed. Returns a buffer
var s = pearson.seed();

//To calculate a hash. Returns a buffer. hashLength must be an integer between 1 and 8
var h = pearson(data, hashLength, seed);

//If the seed is omitted, the function will return an {hash, seed} object containing the hash buffer and a newly generated seed
//If the hashLength is omitted, the function will generate an 8-byte long hash by default.

License

This module has been written by Ahmad Benmrad. It is released under the terms of the MIT License.