[bittorrent] Pieces hash verification
joris.guisson at gmail.com
Tue Oct 5 02:27:44 EDT 2010
2010/10/5 André Martins <andmart at gmail.com>:
> Hi all,
> I'm building a client and this part of verification is not totally clear
> for me.
> I'm wondering against hash of what should I compare the hash that comes in
> the metafile *.torrent entry "pieces".
> Should I save the downloaded piece into a file and take the hash of the file
> or take the hash from a binary array with the downloaded bytes? or else?
Why would you want to save to a file when you have the data in memory
? You can just pass the downloaded data to your SHA1 implementation.
> Could anyone give me a hint how to do that?
I would recommend using a library which implements SHA1 (openssl,
libgcrypt, ...), no need to reinvent the wheel.
> Thanks in advance.
> André Martins
> BitTorrent mailing list
> BitTorrent at lists.ibiblio.org
More information about the BitTorrent