| View previous topic :: View next topic |
| Author |
Message |
marcvilmet Guest
|
Posted: Thu Oct 09, 2008 8:47 am Post subject: Question to developper about file hash |
|
|
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
|
Posted: Thu Oct 09, 2008 9:41 am Post subject: |
|
|
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 |
|
 |
marcvilmet Guest
|
Posted: Thu Oct 09, 2008 10:46 am Post subject: Another problem |
|
|
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
|
|
| Back to top |
|
 |
|
|
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
|
Powered by phpBB © phpBB Group
|
|
|
|