Changeset 36 for trunk

Show
Ignore:
Timestamp:
21.07.2005 12:58:22 (3 years ago)
Author:
m
Message:

Info hash is created during decodeFile()

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/infohash.php

    r29 r36  
    33    /** 
    44    * Info-Hash Test 
    5     * Get Info from a .torrent file 
     5    * Compares the info_hash compution of this package to the original program implementation 
    66    * 
    77    * Usage: 
     
    1212    */ 
    1313 
     14    error_reporting(E_ALL); 
     15 
    1416    // Includes 
    1517    require_once 'File/Bittorrent/Decode.php'; 
    16     require_once 'File/Bittorrent/Encode.php'; 
    1718    require_once 'Console/Getargs.php'; 
    1819 
     
    3839 
    3940    $File_Bittorrent_Decode = new File_Bittorrent_Decode; 
    40     $File_Bittorrent_Encode = new File_Bittorrent_Encode; 
    41     $decoded = $File_Bittorrent_Decode->decode(file_get_contents($torrent)); 
     41    $File_Bittorrent_Decode->decodeFile($torrent); 
    4242 
    4343    echo "\nInfo Hash\n"; 
    4444    echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"; 
    45     echo "This:           " . sha1($File_Bittorrent_Encode->encode($decoded['info'])) . "\n"; 
    46      
     45    echo "This:           " . $File_Bittorrent_Decode->info_hash . "\n"; 
     46 
    4747    exec('/usr/bin/btshowmetainfo.py ' . escapeshellarg($torrent), $bt); 
    4848    echo "btshowmetainfo: " . substr($bt[3], strpos($bt[3], ':') + 2) . "\n"; 
    49     
     49 
    5050?>