arvidn / libtorrent

an efficient feature complete C++ bittorrent implementation
http://libtorrent.org
Other
5.11k stars 988 forks source link

[Feature request] Quick file check #7367

Open master255 opened 1 year ago

master255 commented 1 year ago

@arvidn It is necessary to add a new flag and algorithm to torrent_session to check files more quickly. Now the checking is done by calculating file hashes. The new flag will mean checking with three parameters:

  1. File path
  2. File size
  3. Date of file modification (if any)

If these three parameters match, consider the file verified.

Milbret commented 1 year ago

Sounds like a bad idea.

  1. Date of (last) file modification can simply set by every Script/Program and it is only a local Information that has no value for a valid File Check here.
  2. File Size isn't an safe Information. I can produce the same File with the same size but all filled with 0 Zero Bytes.

The current Hash checks the hashes of every single Block in the File not the file itself as far as i know. This hashes are contained in the .torrent file.

Infos: https://en.wikipedia.org/wiki/Torrent_file#File_structure

master255 commented 1 year ago

@Milbret You are talking to a professional who made his own torrent library, DHT library, torrent streaming via https protocol, fast torrent files update. Obviously your level is too low to understand what is written here :)

Milbret commented 1 year ago

What kind of professional? Seams like you missed a lot of stuff here to understand how torrent hashing work.

If you have your own torrent library why should libtorrent add something that technical doesn't make any sense? This "Feature" wouldn't ensure that the torrent is valid in any way. If a single bit of one block is invalid, then the whole file is. With this Feature you would ignore invalid blocks as long as the path, file size and "maybe" the Date of last modification is identical. With that a malicious client or a user with broken files could send garbage and you would accept it as valid. Doesn't sound professional at all ;-) And i don't see who wants to use it but clearly you could provide a use case for this.

master255 commented 1 year ago

This is an optional file check. Additional to the basic functionality. Libtorrent has a mechanism for detecting corrupted files during distribution. So there will be no problem with cheating other clients. Already all torrent clients have the ability to add an already downloaded torrent without checking the data at all, and this option will do a quick check. This will save users a lot of time.

stale[bot] commented 10 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.