@ryanburnette/hashcash

An asynchronous implementation of hashcash for Node.js and the browser.

Usage no npm install needed!

<script type="module">
  import ryanburnetteHashcash from 'https://cdn.skypack.dev/@ryanburnette/hashcash';
</script>

README

hashcash

repo npm

An asynchronous implementation of hashcash for Node.js and the browser.

Usage

Require and create an instance. Pass in optional seed string. Pass in optional need string to increase complexity.

var hashcash = require('@ryanburnette/hashcash');
var h = hashcash();

Check to see if a value passes.

h.check(0).then(function(result) {
  console.log(result);
});

Do the work.

h.solve().then(function(solution) {
  console.log(solution);
});

Package

The package works as-is on Node.js and will work with webpack or rollup for packaged browser use.

For direct browser implementation, use ./dist/hashcash.js or via cdn...

<script src="https://unpkg.com/@ryanburnette/hashcash/dist/hashcash.js" />