hashcash v1.0.2

Crystal Lang implementation of Hashcash proof-of-work systems. Generates and verifies Hashcash strings.

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

Repository

hashcash

Owner
Statistic
  • 1
  • 0
  • 1
  • 1
  • 0
  • over 1 year ago
  • December 3, 2020
License

MIT License

Links
Synced at

Fri, 03 May 2024 00:50:12 GMT

Languages