5 ms·
This right here is the biggest new feature in my opinion, and should have been discussed in more depth in the announcement. I also think they should have pursue
by Thorentis 6y ago
This right here is the biggest new feature in my opinion, and should have been discussed in more depth in the announcement. I also think they should have pursued this avenue further before releasing v2.
Content addressing is one of the big advantages of p2p applications, and IPFS has been pushing it for a long time.
Just imagine if this was done all the way down to the piece level. You have two different torrents (say, Linux ISOs) where 20% of the pieces overlap due to similarity (maybe a point upgrade or something and you want both versions). Rather than 100% of both, you only need to download the shared pieces once. Not only that, but say that the latest version has many more seeds/peers, you could download the pieces from that swarm instead, saving the bandwidth of the older torrent's swarm for the remaining 80% you need to download.
This could probably be done client side somehow, but it would be good to see actual protocol support for it so that bittorent can move in that direction.
- Ericson2314 6y agoHopefully it would also be good for interopt between the two, as anything with a small enough block size could be picked up by IPLD.
- sbierwagen 6y ago>Just imagine if this was done all the way down to the piece level. I don't know about that. With a reasonably large number of users, wouldn't you start seeing hash collisions via birthday paradox? Might be better off keeping it at the file level. (Though this does incentivize malicious users to find hash collisions of particular files they want to defend, and seeding the swarm with garbage files)
- doomrobo 6y agoHashes are now 256 bits. In order to get a collision with probability 1% you need to produce about 4e37 hashes. For comparison, if you had a 5GHz computer that did a SHA-256 hash every cycle and gave 100 of these computers to every human on Earth, it'd take over 300 million years to produce 4e37 hashes.
- ShinTakuya 6y agoYep, basically while it's entirely possible (as per Murphy's Law) that there'll be an accidental collision, the likelihood is close to zero. It's a fair risk to be taking.
- fenomas 6y ago> In order to get a collision with probability 1% you need to produce about 4e37 hashes Does "get a collision" here mean finding a particular collision with a known hash, or finding any collision between any two of the generated hashes?
- fomine3 6y agoAll git objects on GitHub has unique hash in 2017 even though git uses relatively weak SHA-1. SHA-256 should be safe. https://github.blog/2017-03-20-sha-1-collision-detection-on-github-com/ https://github.blog/2017-03-20-sha-1-collision-detection-on-...
- em-bee 6y agothe birthday paradox comes from the fact that there are an extremly small number of birthdays. sha-256 was chosen because it provides a sufficiently high number of different hashes that this won't be an issue for the forseeable future. more details here: https://stackoverflow.com/questions/4014090/is-it-safe-to-ignore-the-possibility-of-sha-collisions-in-practice https://stackoverflow.com/questions/4014090/is-it-safe-to-ig...
- sedatk 6y agoOnly if blocks have the same offset in the same binary and if they align with the block boundaries. Otherwise, different hashes would be generated. I don't expect that to happen a lot.
- naikrovek 6y agoWell if files in an ISO are aligned to some boundary it would help a lot, similar to how filesystems on disk have a sector size, where all files begin at the start of a sector. However, I don't know if this is true in ISO9660 or any of its extensions.
- em-bee 6y agoISO is a mountable filesystem so this could be the case if it doesn't have any space saving optimizations that create variable block sizes. also need to watch out for compression
- computerphage 6y agoIt will still definitely help some use cases: > 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.
- aurelian15 6y agoThere are ways around this. See "content-aware chunking", e.g. implemented using rolling hashes [1]. This is for example what rsync does. The idea is to make blocks (slightly) variable in size. Block boundaries are determined based on a limited window of preceding bytes. This way a change in one location will only have a limited impact on the following blocks. [1] https://en.wikipedia.org/wiki/Rolling_hash https://en.wikipedia.org/wiki/Rolling_hash
- octoberfranklin 6y agoRolling hashing is really only useful for finding nonaligned duplicates. There isn't a way to advertise some "rolling hash value" in a way that allows other people with a differently-aligned copy to notice that you and them have some duplicated byte ranges. Rolling hashes only work when one person (or two people engaged in a conversation, like rsync) already has both copies.