An xxhash binding for node.js

npm install xxhash
2 downloads in the last day
75 downloads in the last week
386 downloads in the last month


An xxhash binding for node.js.



npm install xxhash


  • Hash a file in one step:
var XXHash = require('xxhash'),
    fs = require('fs');

var file = fs.readFileSync('somefile'),
    result = XXHash.hash(file, 0xCAFEBABE);
  • Hash a file in steps:
var XXHash = require('xxhash'),
    fs = require('fs');

var hasher = new XXHash(0xCAFEBABE);

  .on('data', function(data) {
  .on('end', function() {
    console.log('Hash value = ' + hasher.digest());


XXHash Static Methods

  • hash(< Buffer >data, < integer >seed) - integer - Performs a single/one-time hash of data with the given seed. 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 of data 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.

npm loves you