Hashcash


Hashcash is an anti-spam / denial of service counter-measure tool.

A hashcash stamp constitutes a proof-of-work which takes a parameterizable amount of work to compute for the sender. The recipient (and indeed anyone as it is publicly auditable) can verify received hashcash stamps efficiently.

E-mail senders attach hashcash stamps with the X-Hashcash header. Vendors and authors of anti-spam tools are encouraged to exempt e-mail sent with hashcash from their blacklists and content-based filtering rules.

This library provides basic utilities for hashcash creation and validation.

Creating stamps
mint ( resource -- stamp )

mint* ( tuple -- stamp )


Validation
valid-stamp? ( stamp -- ? )

valid-date? ( yymmdd: string -- ? )


Hashcash tuple and constructor
hashcash

<hashcash> ( -- tuple )

expiry-days


Private utilities
on-or-before-today? ( yymmdd: string -- x ? )

now-gmt-yymmdd ( -- yymmdd: string )

yymmdd-gmt-diff ( yymmdd: string yymmdd: string -- days )

yymmdd-gmt>timestamp ( yymmdd: string -- timestamp )

timestamp>yymmdd ( timestamp -- yymmdd: string )

lastn-digits ( n digits -- string )


See also
ascii-password

Further readings
https://en.wikipedia.org/wiki/Hashcash

https://www.hashcash.org/

https://www.hashcash.org/papers/hashcash.pdf

https://dbpedia.org/page/Hashcash

https://nakamoto.com/hashcash/