11

I have been using uTorrent for a long time. I have used its "force recheck" feature countless time. Every time it surprises me how uTorrent successfully detects which parts of the file had been downloaded and which parts are yet to be downloaded. It checks them even if you are not connected to internet; so I presume that it doesn't download any data from internet to do this check.

Can you please explain me how this "force recheck" feature works. I think that a hash for every single piece is kept in the .torrent file; but I'm not sure, it is just a guess. I searched in Google with keywords "torrent file format" to find the file format of .torrent files, but instead it returned a lot of torrent search results. So Google is not my friend this time. Please explain it to me.

8

As I understand it, the torrent file contains a hash for each piece of the file you are downloading. It simply checks the hashes for each piece you think you have, against the checklist. Much like when you download a torrent, any piece that does not match is discarded.

In more detail, based off the bitorrent specifications you have your downloaded file, 'piece length' and 'pieces'. Piece length is the size of each piece, and pieces is simply the sha1 sum of each piece, appended to the previous piece to form a long string.

To simplify things, lets assume you preallocated the file, and you basically have a large 'padded' file of equal length to your source file. First, based off piece length, the program gets the first n bits of the file, and does a SHA1 sum. It then compares the SHA1 sum of the file to the corresponding part of 'pieces'. If they match, we're good. Else, its marked as no good and discarded.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.