RHash
RHash copied to clipboard
add algorithm: bittorrent v2 merkle root hash
btih and ed2k hashes are already supported, so adding this seems legit
implementations of the bittorrent v2 merkle root hash algorithm:
- https://github.com/arvidn/libtorrent - C++
- https://github.com/arvidn/libtorrent/blob/RC_2_0/src/merkle.cpp
- https://github.com/arvidn/libtorrent/blob/RC_2_0/src/merkle_tree.cpp
- https://github.com/milahu/bittorrent-v2-merkle-root-hash-py - python
- more comments in https://github.com/milahu/bittorrent-v2-merkle-root-hash-py/blob/2148ef1e822ea71182eb9f2ffabf7f1347dd5dfe/bt2_root_hash.py#L267
- this is a simple, non-incremental implementation, which needs more RAM on larger files: 32 byte (sha256 hash) per 16*1024 byte block of file plus zero-blocks
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: https://github.com/namazso/OpenHashTab/issues/193
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/.
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.