hashcash_dart 0.1.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 50

Hashcash #

Hashcash is a proof-of-work algorithm, which has been used as a denial-of-service counter measure technique in a number of systems.

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. Hashcash was invented by Adam Back in 1997

At this point it is most widely used as the bitcoin mining function.

The email anti-spam tool, like the proof-of-work algorithm, is also called hashcash and is used to create stamps to attach to mail to add a micro-cost to sending mail to deter spamming. The main use of the hashcash stamp is as a white-listing hint to help hashcash users avoid losing email due to content based and blacklist based anti-spam systems.

Hashcash source code includes a library form, and also the algorithm is extremely simple to code from scratch with the availability of a hash library. Verification can be done by a human eye (count leading 0s) even with availability of common preinstalled command line tools such as sha1sum. The algorithm works with a cryptographic hash, such as SHA1, SHA256 or coming SHA3 that exhibits 2nd-preimage resistance. Note that 2nd-preimage resistance is a stronger hash property than the collision resistance property.

Usage #

A simple example:

import 'package:hashcash/hashcash_dart.dart';

main() {
  var stamp = Hashcash.mint('konstantinullrich12@gmail.com');
  var checked = Hashcash.check(stamp, resource: 'konstantinullrich12@gmail.com');
}

Features and bugs #

Please file feature requests and bugs at the issue tracker.

0.1.0 #

  • adjust naming

0.0.1 #

  • Implement the Hashcash protocol Version 1

example/hashcash_dart_example.dart

import 'package:hashcash_dart/hashcash_dart.dart';

void main() {
  print('Hashcash Protocol version: ${Hashcash.version}');

  var stamp = Hashcash.mint('konstantinullrich12@gmail.com');

  print(Hashcash.check(stamp, resource: 'konstantinullrich12@gmail.com'));
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  hashcash_dart: ^0.1.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:hashcash_dart/hashcash_dart.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
50
Learn more about scoring.

We analyzed this package on Jul 9, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.13

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.7.0 <3.0.0
crypto ^2.1.3 2.1.5
Transitive dependencies
charcode 1.1.3
collection 1.14.13 1.15.0-nnbd
convert 2.1.1
typed_data 1.2.0 1.3.0-nnbd
Dev dependencies
pedantic ^1.8.0
test ^1.6.0