Hacker News new | ask | show | jobs
by StavrosK 2119 days ago
Do magnet links work across torrents? Do two different torrents of the same file have the same magnet URI?
3 comments

The infohash (which identifies the torrent, and thus the magnet link) is a hash of the following structure:

http://bittorrent.org/beps/bep_0003.html#info-dictionary

There are some things, beyond the content of the file, that will change the hash:

- Path of the file (nature_documentary.avi vs root/nature_documentary.avi)

- Name of the file (nature_documentary.avi vs nature_doc.avi)

- The pieces length

Ah, if it's the entire dictionary and not filtered by the clients to just those fields, then presumably additional data may be shoved in—specifically the trackers to contact.
No, look at the content of the dictionary: trackers are not part of the "info" dict, so you can add all the trackers you want, it won't change the identity of the torrent. Identity is defined by the infohash.

Trackers are added in the magnet link by adding parameters to the URI: see http://bittorrent.org/beps/bep_0009.html

Not sure if any metadata other than the file name affects the hash—e.g. modification times. Chunk sizes likely do. Otherwise, I'd expect the hash to address actual content, though frankly I haven't checked.

Edit: in fact, my hasty, belated and superficial skimming suggests that IPFS is an implementation of just a DHT (presumably with some metadata and chunking built in)—i.e. it keeps data itself in about the same way that Bittorrent stores torrent descriptions in the Mainline DHT.

magnets are just hashes of the contents