Create Base32 SHA1 hashes out of files in PHP 5

LimeWire and other Gnutella clients uniquely identify files by creating a SHA1 hash of the files.

I thought that it might be useful to the gnutella network to have regular webservers sharing legal files.

Usually regular Joe webmasters don’t have permissions to run java programs or have tcp ports open due to their webhosting contracts, however most of them can run PHP script, and some hosting companies allow for PHP5. This post is to have one more reason to start moving to PHP5 and one small step towards having more websites distributing content straight to the Gnutella network.
A few weeks LimeWire developer Karl Magdsick developed a simple base32 converter in python, he was creating a simple gnutella servent, I thougt I could build a set of PHP5 scripts which could serve files out of magnet link requests, PHP has a sha1 function but it won’t return results in base32, and Karl’s script was the missing link. Today he gave me his python base32 converter which I just ported to PHP5 and I couldn’t wait one second to share it with you all.
This will be the first step to building an open source Gnutella Server in PHP5.

I release this utility class under the GPL, use it for Magnet links, and Gnutella file sharing as you please.

Next possible steps:

– Serving a file with a php5 script after a LimeWire client hitting the script from a magnetlink

– Keep track of alternate locations

– When serving the files, send Alt-Loc headers 🙂

– Make more scripts to easily manage/share files on your server , and create a simple MySQL/PHP5 based website that publishes magnet links.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.