Skip to content

bfolkens/hashcash-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hashcash JS

Build Status

A simple npm module to generate a Hashcash signature with challenge, for those times when you're fighting off the spam.

Install

npm install hashcash

or

yarn add hashcash

Usage

import Hashcash from 'hashcash'

Generating a stamp

const stamp = Hashcash.generateStamp(16, "unique-data-goes-here")
console.log(stamp)

Would output something like the following (except the trail):

1:16:20180708232351:unique-data-goes-here::xDnc81q

Assumptions

In this implementation we've used HHMMSS on the timestamp, instead of the original date-only approach. This gives more flexibility to the receiving side for strict checking per minute, second, hour, etc. Changing this precision may be an option in future releases.