I’m slowly working through my backlog of open source pet-projects. One that I worked on quite a while ago was called NHashcash, a managed .NET implementation of the anti-spam mechanism, Hashcash. Hashcash hasn’t been broadly adopted as far as I can tell but I thought it would be interesting to make the library available via NuGet anyway.
You can install the NHashcash library by issuing the following command on the NuGet package manager console:
The screenshot below highlights this command and the assembly that it adds to the currently selected project references. The sample code is just there to give you an overall taste for the API (its very simple to use).
If you are interested in the source code you can grab it from the project portal on CodePlex. The 1.1.0 version of NHashcash has a major bug fixed there the timestamp used for stamps was incorrectly being generated. I guess its a testament to how few people use Hashcash that the bug was never found, and also how poor my initial unit tests were.
On the unit testing front I’ve improved the tests somewhat to validate against the reference implementation of Hashcash (which was how I found the bug). I also used the MSTestContrib library that I blogged about a few days ago to make the tests more BDD-style.
Finally, there is more work to be done around performance on NHashcash since it was never an optimal implementation. Anyway – if you can’t use NuGet you can always download it directly from here.