Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hybrid Hash value aren't matching v1 hash nor v2 hash #7654

Open
K-Jtan opened this issue Mar 18, 2024 · 3 comments
Open

Hybrid Hash value aren't matching v1 hash nor v2 hash #7654

K-Jtan opened this issue Mar 18, 2024 · 3 comments

Comments

@K-Jtan
Copy link

K-Jtan commented Mar 18, 2024

Please provide the following information

libtorrent version (or branch): libtorrent-rasterbar 2.0.10

platform/architecture: Linux (Solus and Arch Linux), x86_64

compiler and compiler version: gcc 13.2,

please describe what symptom you see, what you would expect to see instead and how to reproduce it.

  • Use a file of your choice in conjunction with libtorrent to create 3 different torrent files. The first one containing only hash v1 (lt::create_torrent::v1_only), The second one containing only hash v2 (lt::create_torrent::v2_only), The third one containing both hash (also know has hybrid torrent)
  • Open the three files with qBittorrent (v4.6.3). In the hybrid torrent file, "Torrent information" section you will notice that the Info hash v1 and Info hash v2 isn't matching the value found in the v1 torrent file nor the v2 torrent file.

I was expecting those values to match as people seeding hybrid torrents should be able to help all the leeching pools (v1_only and v2_only).

Maybe there is something I don't understand correctly. Please let me know if I'm in the wrong here.

@arvidn
Copy link
Owner

arvidn commented Apr 6, 2024

the v1 info-hash commits to everything in the info section of the torrent file. A hybrid torrent must necessarily have some v2 fields in it, so the v1 hash will be different from a v1-only torrent.

The same applies to a v2-only torrent. It won't have the backwards-compatible v1-fields in its info section, so its info-hash must also be different.

Torrents created independently, of the same underlying files, are unlikely to have the same info-hash. Some reasons are:

  1. The ordering of the files is non-deterministic
  2. The piece size may be different
  3. the torrent creator may include extension fields (like file-hash or file attributes)

In other words, if you create a torrent and someone else also creates a torrent of the same files, the default assumption ought to be that they differ.

v2 torrents made some attempts to improve the situation by making the order of files be well defined.

All that said; the v2-only and the hybrid torrents will still share the file root hashes of the files (assuming they are identical). So there's still a mechanism to share files between v2 torrents, but the support for this is not developed in libtorrent yet.

@K-Jtan
Copy link
Author

K-Jtan commented Apr 6, 2024

Thank you so much for this great response.

This means that if I were to create the 3 torrent versions (v1, v2, and hybrid) I would have to seed the 3 of them in parallel as they would not connect to the same user pool. My initial thought was to seed only the hybrid torrent and people could use the v1 and v2 depending what their client supports, but in practice this isn't the case.

As I'm writing these lines, I realize that I'm probably confusing the info-hash of a torrent with the checksum hash.

@arvidn
Copy link
Owner

arvidn commented Apr 7, 2024

You could also just seed the hybrid and everybody can use the hybrid torrent. It’s compatible with v1 clients as well as v2 clients

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants