xxhash-nan
An xxhash binding for node.js. Forked from the original to add compatibility with future versions of node via NAN.
Installation
You must be running node 0.8 or later. (Thanks to an npm 2.0 compatibility issue, travis tests fail on 0.8.)
npm install xxhash
Examples
- Hash a file in one step:
var XXHash = fs = ; var file = fs result = XXHashhashfile 0xCAFEBABE;
Hash a file incrementally:
var XXHash = fs = ; var hasher = 0xCAFEBABE; fs ;
API
XXHash module functions
- hash(< Buffer >data, < integer >seed) - integer - Performs a single/one-time hash of
data
with the givenseed
. The resulting hash is returned.
XXHash Methods
-
(constructor)(< Integer >seed) - Create and return a new Hash instance that uses the given
seed
. -
update(< Buffer >data) - (void) - Update the hash using
data
. Note: the length ofdata
must be a positive signed integer (e.g. 0 to 2,147,483,647 bytes). -
digest() - integer - Completes the hashing and returns the resulting integer hash. Note: hash object can not be used after digest() method been called.