Archived

This topic is now archived and is closed to further replies.

networkinfo

calculate info hash

Recommended Posts

Hello

From a torrent example

d8:announce27:http://example.com/announce7:comment7:Example10:created by13:uTorrent/181013:creation datei1232326057e8:encoding5:UTF-84:infod6:lengthi7660e4:name11:torrent.php12:piece lengthi65536e6:pieces20:7vEȹœ£“h‰Éâ:WzEpee

I try to calculate the hash

sha1('d6:lengthi7660e4:name11:torrent.php12:piece lengthi65536e6:pieces20:7vEȹœ£“h‰Éâ:WzEpe');

It gives me d25b89e241afc48b9e1cf20d46a9d13f05d41634 but the hash is c402e422692f67685c634870eba87eaece044996

What am i doing wrong ?

Thank in advance

Share this post


Link to post
Share on other sites
The hashsum is created from the DATA.

The data of the file ?

 info_hash: urlencoded 20-byte SHA1 hash of the value of the info key from the Metainfo file. Note that the value will be a bencoded dictionary, given the definition of the info key above. 

I have to find the hashsum not the info_hash????

:rolleyes:

I'm trying to create a torrent form a file in php

Share this post


Link to post
Share on other sites

Sorry i don't understand and i search for several week

Maybe it's because im french and my english is not enough good

I'd like to generate a torrent file from a file simply like this

d8:announce27:http://example.com/announce7:comment7:Example10:created by13:uTorrent/181013:creation datei1232326057e8:encoding5:UTF-84:infod6:lengthi7660e4:name11:torrent.php12:piece lengthi65536e6:pieces20:7vEȹœ£“h‰Éâ:WzEpee

Altough i read bittorent protocol i don-t understant this part

7vEȹœ£“h‰Éâ:WzEpe

It is the sha1 of what exactly ?

I have read all that i found, can you help me ?

Share this post


Link to post
Share on other sites

infohash, specifically a hash of the value of the info dictionary contained within the .torrent. You don't hash the whole file...

Share this post


Link to post
Share on other sites