[BitTorrent] sha1 and .net class library

antipast0 at yahoo.com antipast0 at yahoo.com
Thu Aug 26 16:10:27 EDT 2004


Hello all! I've been trying to calculate the info_hash from 
a .torrent, and it just seems like the SHA1 functions in .NET are 
broken. Either that, or I'm screwing up my text encoding.

When I see an infohash in Azureus, for example, it looks like this:
C159FAEF7CD129897FAB35BE2E98BFF420BFA2C2

... and I can get things to do a SHA1 hash similar to this, but they 
always come up different:
6EF34A50CF03A98C4AA112DD47D572394234FE5B

I guess my question would be... What encoding are the hashes in 
a .torrent file? Is that just raw binary? Hex? What are those block 
of hashes? I know that they are 20 blocks of hashes, but a lot of 
weird characters go on there. 

I've tried UTF8 (which has about the most success, if you can call it 
that), UTF7, Unicode, Big Endian Unicode, ASCII, etc...

Its crazy that in PHP you just do sha1($infoarray) and everything 
works fine! Geez... silly microsoft.

Second, when the specification says that this is a hash of the info 
dictionary's value, does that mean bencoded? and if so, does it 
include the dictionary's beginning "d" and ending "e" ? Perhaps I'm 
just including too much information, but technically that's the 
string value of the "info" key in the main dictionary.... Does it 
also include the length of the info dictionary beforehand? 
like "456:d..."

Thank you guys so much,

Thomas






------------------------ Yahoo! Groups Sponsor --------------------~--> 
$9.95 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/J8kdrA/y20IAA/yQLSAA/dkFolB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/BitTorrent/

<*> To unsubscribe from this group, send an email to:
    BitTorrent-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



More information about the BitTorrent mailing list