Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create a Hashcash in PHP

Tags:

php

After searching the Web, I couldn't find an answer on how to create a hashcode in php.

I'm writing a Newsletter-Tool and don't wan't to get blacklisted, ok who wants :-)

I have already checked my reverse DNS, SPF an spamhouse.org...

Can someone help me out on how to create a hashcash in PHP (with example)?

like image 737
Michele Avatar asked Nov 13 '22 07:11

Michele


1 Answers

TheFox has implemented Hashcash into PHP which is available on Github

Installation

The preferred method of installation is via Packagist and Composer. Run the following command to install the package and add it as a requirement to composer.json:

composer.phar require "thefox/hashcash=~1.0"

Example

An example usage of that implementation is:

<?php
require 'vendor/autoload.php';
use TheFox\Pow\Hashcash;
$hashcash = new Hashcash(20, '[email protected]');
print "hashcash stamp: '".$hashcash->mint()."'\n";
?>

Also, the hashcash.org website has developer notes on how to implement it yourself as well as OS specific tools available which can be used via shell_exec() in PHP

like image 83
Tim Penner Avatar answered Nov 16 '22 02:11

Tim Penner