Live data from Hacker News

BitTorrent v2 (2020)

blog.libtorrent.org

91–100 of 155 posts

Re: BitTorrent v2 (2020)

#91

BitTorrent slaps so hard as a protocol, and DHTs are absolutely brilliant. With all of the recent hype about decentralization with the rise of crypto, I'm surprised BitTorrent hasn't seen much hype or revitalization as well.

The creator of BitTorrent, Bram Cohen, is now full time focused on crypto: https://www.chia.net/

It's a novel layer 1 crypto with some interesting tech behind it. A lot of decentralized nodes inspiration from BT went into it as well.

Re: BitTorrent v2 (2020)

#92
The per file hash to assist in deduplication is pretty neat. Wonder if it could be taken a step further by chunking files into blocks based on a rolling hash, so that it can dedup portions of a file as well (a la lbfs https://pdos.csail.mit.edu/archive/lbfs/). Or does anyone know if it already does that?

Re: BitTorrent v2 (2020)

#93

Can someone explain how the Merkle-tree concept is useful? I didn't quite catch that part. On the one hand it is says: > all you need is the root hash of the tree. but on the other hand: > the .torrent file must still contain these piece hashes So what are we saving here? If a piece hash doesn't match the downloaded data, we re-download the piece.

The .torrent file is separate to the torrent metadata which you need to fetch for magnet links. This is mentioned a bit later in that section:

> The .torrent file size is not smaller for a v2 torrent, since it still contains the piece hashes, but the info-dictionary is, which is the part needed for magnet links to start downloading.

Also it seems that it'll be easier to detect peers which are sending bad data and correct it. I guess this is because previously you could fetch a piece from more than one peer but because the hashing was done at the piece level you didn't know which part of the block was wrong (meaning you'd have to redownload the whole thing). But now you can -- with a bit of tracking -- tell which block of a piece was sent from which peer and then redownload it from another (likely blocking the original peer), because you know which block hash failed to validate. (EDIT: This is correct -- [1] explains the issue and how torrent clients have worked around this problem in v1 torrents.)

Merkle trees have some other benefits (you can cache parts of the tree in such a way that repeatedly checksumming data where lots of leaves are unchanged is cheaper, and you can efficiently prove that a given leaf was part of the hash), but I don't know if that's going to be useful for BitTorrent.

[1]: https://blog.libtorrent.org/2011/11/smart-ban/

Re: BitTorrent v2 (2020)

#94

Earlier quoted context omitted.

>if SHA256 proves to be insecure slight pedantism here, but "when" not "if"

That's not a given. As far as I know, there is no proof of the security or lack thereof of this kind of function. Increases in computing power alone can't render SHA256 insecure; that can be proven by thermodynamic/size-of-the-universe arguments. You need an actual cryptographic weakness.

> Increases in computing power alone can't render SHA256 insecure; that can be proven by thermodynamic/size-of-the-universe arguments.

Fascinating. Could you please recommend a source where a curious layman could learn more about this?

Re: BitTorrent v2 (2020)

#95

The per file hash to assist in deduplication is pretty neat. Wonder if it could be taken a step further by chunking files into blocks based on a rolling hash, so that it can dedup portions of a file as well (a la lbfs https://pdos.csail.mit.edu/archive/lbfs/ ). Or does anyone know if it already does that?

I've seen a similar idea for BitTorrent but I don't think it was implemented

Re: BitTorrent v2 (2020)

#96
post #58

Earlier quoted context omitted.

SHA1 collision was never much of a reason to change it in the first place; there is no practical attack that arises from it.

1) Take a popular game torrent 2) add crypto mining code 3) pad it so the SHA1 stays the same 4) seed it, the magnet links will pick up your version 5) profit!

Between 1 and 2, remove the crypto mining code that came with it.

Re: BitTorrent v2 (2020)

#98
post #25

Earlier quoted context omitted.

The Wikipedia link is very reassuring regarding the security of SHA256. All attacks are very far away from going anywhere close to attacking full SHA256 and no major progress has been made lately. The password hashing remark is correct, but irrelevant. SHA256 is not a good password hash, because it's not made to be a password hash. Don't use it for passwords. The weaknesses that broke MD5/SHA1 were known since 1994.…

I’m not a cryptographer. Why isn’t SHA256 good as a password hash? Can you explain? And what’s a better alternative, and why?

> Why isn’t SHA256 good as a password hash?

Because it wasn't designed for it. For password hashing you want a hash that has a salt (so that the same password on two accounts doesn't have the same hash on the database) and is as slow as possible (that is, fast enough to validate on logins) to increase brute-force time.

Historically Bcrypt was a good option, but I think Argon2[0] is the current best option.

[0] https://en.wikipedia.org/wiki/Argon2

Re: BitTorrent v2 (2020)

#99
post #25

Earlier quoted context omitted.

The Wikipedia link is very reassuring regarding the security of SHA256. All attacks are very far away from going anywhere close to attacking full SHA256 and no major progress has been made lately. The password hashing remark is correct, but irrelevant. SHA256 is not a good password hash, because it's not made to be a password hash. Don't use it for passwords. The weaknesses that broke MD5/SHA1 were known since 1994.…

I’m not a cryptographer. Why isn’t SHA256 good as a password hash? Can you explain? And what’s a better alternative, and why?

Because SHA256 is fast to compute. This means that an attacker can quickly try many passwords, either from a dictionary of common passwords or simply brute forcing a short password.

Also, if you use SHA256 bare without salt you are vulnerable to precomputed dictionaries. There is a fascinating way to make these dictionaries shorter called Rainbow Tables.

Better key derivation functions take a lot of time and memory to make it costly for the attacker to a lot of guesses at the password and they have built in salt. Examples would be SCrypt or Argon2.

Re: BitTorrent v2 (2020)

#100
post #85

From a technical perspective, I love BitTorrent. I remember reading about it years ago and being amazed at the bandwidth efficiency and robustness it had. It still had some centralization (ie trackers) but they themselves could be duplicated (ie you could set up a tracker for an existing torrent). The part that surprises me from reading this is the issues raised from moving from SHA1 to SHA256, specifically because t…

if you design a protocol to somehow have "upgradable" hashes, clients still need to be patched to support them, and old clients still will not work. Its the same mistake TLS and IPSEC made, supposedly extensible, but not really because to actually get new features, clients all need to be upgraded, and old incompatible clients still exist, and will never work with whatever new features you want to employ.

You aren't really gaining anything, and you might as well just have new versions of the protocol, and save all the pointless ceremony, complexity and security holes.

There is no way (beyond maybe embedding some kind of executable code in the protocol itself, which seems like an insane idea) to have support from "day one" for algorithms and functionality that don't even exist yet.

Post reply on HN