PHP Classes

Torrent Pieces Hash Verification: Compare downloaded data with torrent data

Recommend this page to a friend!
  Info   View files View files (9)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 907 All time: 3,914 This week: 488Up
Version License PHP version Categories
torrenthash 1.0Public Domain5.0PHP 5, Files and Folders, P2P


This package can be used to compare downloaded data with torrent data.

It can compare hashes from torrent metadata file with an actual torrent data directory to produce a report of which files or pieces need to be downloaded again and how much data remains to be downloaded in MB.

It can also be used when the original torrent data has been updated or changed for some reason.

Innovation Award
PHP Programming Innovation award nominee
January 2009
Number 13

Prize: One book of choice by Manning
BitTorrent is a popular peer to peer program that is used to download programs and data from the Internet.

Sometimes a download needs to be interrupted due to loss of Internet connection of for some other reason.

This class can be used to determine how much data needs to be downloaded to complete an unfinished BitTorrent download.

Manuel Lemos
Picture of Charalampos Pournaris
Name: Charalampos Pournaris <contact>
Classes: 2 packages by
Country: United States United States
Age: 38
All time rank: 1830257 in United States United States
Week rank: 185 Up23 in United States United States Up
Innovation award
Innovation award
Nominee: 2x


This package can be used both on Linux/Windows (or any other platform which php supports) in order to compare the hashes from a torrent metadata file with an actual torrent data directory and produce a report of which files /pieces should be re-downloaded and how much data that is (in mb). if for example you have downloaded a torrent's file data (not the .torrent file but the actual data) and the torrent file is for some reason updated or changed you can use this utility to compare the new .torrent file with the data you have already downloaded and see what needs to be downloaded and what size that is. The script takes two required arguments and one optional: compare_hash.php <torrent_file> <path> [output_file] [required] torrent_file: The torrent file from which to read hashes [required] path: The path of the torrent data [optional] output_file: If specified the output will be saved to that file instead of console (stdout). Used packages: BDecode from Andrew Chaus ( File_Bittorrent2 (some methods only) from Markus Tacker, Justin Jones ( If you need more information or have any questions feel free to mail me: charpour at gmail dot com (Replace at with '@' and dot with '.') Charalampos Pournaris

  Files folder image Files  
File Role Description
Plain text file class.bdecode.php Class Bdecode class
Plain text file class.bencode.php Class BEncode class
Plain text file class.hashcheck.php Class Hash Check Class
Plain text file class.torrentfile.php Class Describes a Torrent File
Plain text file class.torrentinfo.php Class Torrent Metadata Information
Plain text file class.torrentpiece.php Class Torrent Piece Class
Accessible without login Plain text file compare_hash.php Appl. Main script file
Accessible without login Plain text file README.txt Doc. Documentation
Accessible without login Plain text file utils.php Aux. Utility functions

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:3,914
This week:488Up