Skip to content

Latest commit

 

History

History
52 lines (37 loc) · 1.39 KB

README.md

File metadata and controls

52 lines (37 loc) · 1.39 KB

hashcash

CI

Crystal Lang implemenation of Hashcash proof-of-work system.

Installation

  1. Add the dependency to your shard.yml:

    dependencies:
      hashcash:
        github: place-labs/hashcash
  2. Run shards install

Usage

require "hashcash"

To generate a hashcash string:

Hashcash.generate("resource")
# => "1:20:201206222555:resource::pOWgc88+uDuefr/o:MTMxNzg2MA=="

To verify a hashcash string:

Hashcash.valid?("1:20:201206222555:resource::pOWgc88+uDuefr/o:MTMxNzg2MA==", "resource")
# => true
Hashcash.valid!("1:20:201206222555:resource::pOWgc88+uDuefr/o:MTMxNzg2MA==", "resource")
# => "1:20:201206222555:resource::pOWgc88+uDuefr/o:MTMxNzg2MA=="
# (or raises an exception if invalid)

Contributing

  1. Fork it (https://github.com/your-github-user/hashcash/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors