ryanburnette / hashcash

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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" />

About

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

License:ISC License


Languages

Language:JavaScript 100.0%