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

add algorithm: bittorrent v2 merkle root hash #247

Open
milahu opened this issue Sep 22, 2023 · 2 comments
Open

add algorithm: bittorrent v2 merkle root hash #247

milahu opened this issue Sep 22, 2023 · 2 comments
Labels

Comments

@milahu
Copy link

milahu commented Sep 22, 2023

btih and ed2k hashes are already supported, so adding this seems legit

implementations of the bittorrent v2 merkle root hash algorithm:

this hash is used to share identical files between multiple torrents

effectively, it splits the file into 16*1024 byte blocks, adds zero-blocks to get a power-of-two number of blocks, and builds a binary tree of hashes (merkle tree) over these blocks, where the last hash is the "merkle root hash"

"btrh" (bittorrent root hash) could be used as a short name, similar to "btih" (bittorrent info hash)

similar issue: namazso/OpenHashTab#193

@rhash rhash added the FR label Oct 6, 2023
@ppetr
Copy link

ppetr commented Apr 10, 2024

The short name should rather be btmh (for "BitTorrent Multi-Hash"), following the standardized prefix magnet:?xt=urn:btmh:.

See also https://blog.libtorrent.org/2020/09/bittorrent-v2/.

@milahu
Copy link
Author

milahu commented Apr 18, 2024

The short name should rather be btmh

no, btmh is a different hash

one torrent has one btmh hash (and/or one btih hash)
btmh and btih hash the metadata: file paths, root hashes, ...

there is one "root hash" for every file in the torrent
one torrent has one or more files
the root hashes of files hash only the file contents = content addressing

https://blog.libtorrent.org/2020/09/bittorrent-v2/

Identical files will always have the same hash and can more easily be moved from one torrent to another (when creating torrents) without having to re-hash anything. Files that are identical can also more easily be identified across different swarms, since their root hash only depends on the content of the file.

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

No branches or pull requests

3 participants