Question about Bittorrent V2 File Hashes #7604
Replies: 1 comment
-
there is a reference implementation for creating torrents here: http://bittorrent.org/beps/bep_0052_torrent_creator.py Just a few comments;
|
Beta Was this translation helpful? Give feedback.
-
Hi,
First if this is the wrong venue to ask these questions, i apologize but i seem to have run out of options otherwise.
I am implementing bittorrent support in my own project, which only requires tracker and torrent file generation. (Basically allowing me to expose files as torrents )
I have almost everything working but the file hash generation.
I also cannot use libtorrents2 implementation since my files i generate torrent files for are virtualized and not stored on disk.
Due to several constraints i only support V2 of the bitorrent protocol ( no V1 or Hybrid torrents )
But i can't seem to figure out the hash generation for a given file and BEP 0052 seems very vague in regard.
Right now i am doing the following ( in regards to a single file, as in Bittorrent V2, each file forms its own hash tree )
I use 1 MIB ( 1024 * 1024 )
8 If my file had only once piece, i am done, the root of the block hash tree is also the pieces root.
THIS works correctly, and i get the same pieces root as libtorrentv2 calculates.
My problems start with
I now have one root hash for each piece in my file.
I assume i have to build another hash tree until i have one root hash left.
But so far any attempt to build this has failed, my results never match liborrentv2s results.
I tried padding the piece hash values with zero hashes, with the last hash duplicated and so on until i have a power of two.
I have also tried just calculating the block hash tree over the whole file ....
Beta Was this translation helpful? Give feedback.
All reactions