The new model of libtorrent-2.0, which has been examined for a number of months, is now appropriate with BitTorrent v2. This new protocol seeks to place encryption apart SHA-1 in favor of SHA-256, a lot safer. This change began simply after Google cracked SHA-1 utilizing brute power, displaying how insecure this encryption is. Since this alteration within the hash operate would make the brand new system non-backward appropriate, they determined to introduce more modifications.
The change to SHA-256 causes hashes to turn out to be 32 bytes as an alternative of 20 bytes. To keep compatibility with the DHT and trackers, the data wanted to carry out searches has been trimmed to stay at 20 bytes. However, two totally different “swarms” will nonetheless be created for every torrent relying on the supported protocol utilized by every consumer.
Magnet hyperlinks will load earlier when downloading
To forestall torrent sizes from rising too giant, the best way hashes are recognized has additionally been simplified. With BitTorrent v1, the hashes are chopped up and embrace the torrent file, taking on most of that file. To hold it at a suitable measurement for giant torrent sizes, you may cut back the variety of items into which the torrent is split, however that forces a bigger a part of the ultimate file to be downloaded if there’s any failure within the hash or within the obtain .
Therefore, now with BitTorrent v2 a hashes tree is used, referred to as «merkle hash tree«. Instead of utilizing hashes for every chunk, solely the foundation hash of the tree is required. As a consequence, the latency when including a magnet hyperlink is diminished by having to obtain much less data earlier than beginning a obtain. Second, it will be potential to find if a peer sends a corrupt block, and it will solely be essential to reload 16 kiB.
Torrent recordsdata will embrace these hashes, and their measurement will be smaller than the present ones. Also, the half that the magnets want will be smaller, which will make your obtain begin earlier. Current magnets have the prefix »urn: btih:», and new ones have «urn: btmh:», making them simpler to determine.
There will be hybrid torrent recordsdata appropriate with BitTorrent v1 and v2
Files that are equivalent will have the identical hashes, permitting recordsdata to be simply moved from one torrent to a different when creating them with out having to create new hashes. Thanks to this, it will be potential to search out more seeds in different swarms. With this, recordsdata uploaded to totally different trackers may be downloaded more simply, even when not all recordsdata inside the identical torrent are the identical. For instance, in case you are downloading a best hits album from a music group, and one in every of their songs has the identical hash as one other that seems on the disc it was initially launched on, that explicit track may be downloaded.
To guarantee backward compatibility, it will be potential to create hybrid torrents, the place the recordsdata that we obtain may be obtained from customers who’re utilizing each model v1 and model v2 of BitTorrent. Hybrid torrents will have two hashes, one SHA-1 and one SHA-256.
On the libtorrent web site they’ve put an instance of two torrent recordsdata: one v2 and different hybrid to verify if our torrent supervisor is appropriate. The measurement of v2 is 14 KB, for the 35 KB it might take to be a v1 torrent. The hybrid takes up significantly more, going as much as 90 KB.