Get the InfoHash before the tracker work

A Place For Programmers Of All Levels To Discuss Programming & Web Building.

Moderator: Community Moderator

Post Reply
User avatar
Seraph
Corporal First Class
Corporal First Class
Posts: 52
Joined: 25 Nov 2010, 11:28
Location: Don't know to where I belong
Contact:

Get the InfoHash before the tracker work

Post by Seraph »

We know that when the tracker begin to work, the server will get the InfoHash from the tracker and write it to the mySQL database, and then we can get the InfoHash from the database...
But to get the InfoHash before the tracker work download this
Then copy BEncode.php and BDecode.php to your server's root directory or new folder.

Then use this code to view the infohash:

Code: Select all

<?php

include('./BDecode.php');
include('./BEncode.php');

$tfile = BDecode(file_get_contents("/path/to/torrent/file.torrent"));
$infohash = sha1(BEncode($tfile["info"]));
echo $infohash;

?>
Last edited by Seraph on 26 Dec 2010, 06:49, edited 1 time in total.
Post Reply

Return to “Programming/Web Building Chat & Support”