MLDonkey Forum Index
Homepage •  Bugs •  Tasks •  Patches •  SF.net Project Page •  ChangeLog •  German forum •  Links •  Wiki •  Downloads
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Question to developper about file hash

 
Post new topic   Reply to topic    MLDonkey Forum Index -> Problems with MLDonkey Client (in general, and ed2k, kad, overnet)
View previous topic :: View next topic  
Author Message
marcvilmet
Guest





PostPosted: Thu Oct 09, 2008 8:47 am    Post subject: Question to developper about file hash Reply with quote

Hi everybody,

I have a serious problem and I really need your help.

I am using mldonkey with the bittorent function. When I add a torrent file, mldonkey calculates a hash for the file.

I need to know how the hash is calculated because I would like to write a php script which does the same thing. In fact, I know that the file hash for a torrent file is calculated by the SH1 hash algorithm but when I am using the SH1 hash method I never find the good hash (which is stored in the file files.ini)

Can someone help me ? I am trying to resolve this problem since 1 week and I become crazy...

Thanks for your help.

Marc
Back to top
spiralvoice
Sage


Joined: 06 Jan 2003
Posts: 3983
Location: Germany

PostPosted: Thu Oct 09, 2008 9:41 am    Post subject: Reply with quote

I do not know the exact answer but by looking at the code I can tell you this:

You mean the content of option file_id in files.ini?
This value is computed by using the string content of the .torrent option "info".
Code:
        | String "info", ((Dictionary list) as info) ->
                file_info := info;

This string is converted to SHA1 in bTTorrent.ml, line 294
Code:
let file_id = Sha1.string (Bencode.encode !file_info) in

_________________
Link overview and precompiled cores here: http://mldonkey.sourceforge.net/DownloadLinks
Back to top
View user's profile Send private message
marcvilmet
Guest





PostPosted: Thu Oct 09, 2008 10:46 am    Post subject: Another problem Reply with quote

Thanks for your help. Thanks to you I manage to get ahead with the first part of the difficulty.

By looking in BtGlobals.ml, I found this at line 343

Code:
(Printf.sprintf "BT-%s" (Sha1.to_string file_id)) in


The sha1 hash seems to be converted to a string but I don't find how it works. What are the rules to convert this sha1 hash to the string ?

Can someone help me ?
Back to top
spiralvoice
Sage


Joined: 06 Jan 2003
Posts: 3983
Location: Germany

PostPosted: Thu Oct 09, 2008 3:26 pm    Post subject: Reply with quote

src/utils/lib/sha1* might help
_________________
Link overview and precompiled cores here: http://mldonkey.sourceforge.net/DownloadLinks
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    MLDonkey Forum Index -> Problems with MLDonkey Client (in general, and ed2k, kad, overnet) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Sourceforge.net Logo