hashcashgen

Simple module implementing the hashcash algorithm

Simple module implementing the hashcash algorithm

Install

$ npm install hashcashgen

Usage

var hashcashgen = require('hashcashgen')
  , challenge = require('idgen')()
  , hashcash = hashcashgen(challenge)
  , assert = require('assert')
  ;
 
assert(hashcashgen.check(challenge, hashcash));

Example output:

5zzwQZv3:ORoffSKg

Manual validation:

$ echo -n "5zzwQZv3:ORoffSKg" | sha1sum
000d5a6b2269901c5e5621eb4c2624d4bf642d16  -

Async version:

hashcashgen.async(challenge, function(hashcash) {
  assert(hashcashgen.check(challenge, hashcash));
  done();
});

License

MIT