Release of libtorrent 2.0 with support for BitTorrent 2 protocol

A significant release of the libtorrent 2.0 library (also known as libtorrent-rasterbar) is introduced, providing a memory and CPU efficient implementation of the BitTorrent protocol. The library is used by torrent clients such as Deluge, qBittorrent, Folx, Lince, Miro, and Flush (not to be confused with the other libtorrent library used by rTorrent). The libtorrent code is written in C++ and distributed under the BSD license.

The release is notable for the addition of support for the BitTorrent v2 protocol, which moved away from using the SHA-1 algorithm, which has problems with selection of collisions, in favor of SHA2-256. SHA2-256 is used both to control the integrity of data blocks and for entries in indexes (info-dictionary), which breaks compatibility with DHT and trackers. A new prefix "urn:btmh:" has been proposed for magnet links to torrents with SHA2-256 hashes (for SHA-1 and hybrid torrents, "urn:btih:" is used).

Since the change in hash function breaks protocol compatibility (a field with a hash of 32 bytes instead of 20 bytes), the development of the BitTorrent v2 specification was initially carried out without regard to backwards compatibility and other significant changes were adopted, such as the use of a Merkle hash tree in indexes to reduce the size torrent files and checking downloaded data at the block level.

The changes in BitTorrent v2 also highlight the transition to linking separate hash trees to each file and the application of file alignment in parts (without adding padding after each file), which allows you to get rid of duplicate data when there are identical files and makes it easier to identify different sources for files ... Improved the efficiency of encoding the directory structure in torrent and added optimizations for processing a large number of small files.

To smooth the coexistence of BitTorrent v1 and BitTorrent v2, the ability to create hybrid torrent files, which include, in addition to structures with SHA-1 hashes, indexes with SHA2-256, is implemented. These hybrid torrents can be used with clients that only support the BitTorrent v1 protocol. Due to unresolved stability issues, expected support for the WebTorrent protocol in libtorrent 2.0 has been delayed until the next major release, which will be released no earlier than the end of the year.

Source: linux.org.ru