Search This Blog

Monday, April 22, 2013

Understanding Magnet URI Scheme




The Magnet URI scheme is a de facto standard defining a URI scheme for Magnet links, which mainly refer to resources available for download via peer-to-peer networks. Such a link typically identifies a file not by location, but by content—more precisely, by the content's cryptographic hash value.

Since it specifies a file based on content or metadata, rather than by location, a Magnet link can be considered a kind of Uniform Resource Name, rather than the more common Uniform Resource Locators. Although it could be used for other applications, it is particularly useful in a peer-to-peer context, because it allows resources to be referred to without the need for a continuously available host.

History

The standard for Magnet URIs was developed in 2002, partly as a "vendor- and project-neutral generalization" of the ed2k: and freenet: URI schemes used by eDonkey2000 and Freenet, respectively, and attempts to follow official IETF URI standards as closely as possible.

Applications supporting Magnet links include μTorrent, aMule, BitComet, BitSpirit, BitTorrent, DC++, Deluge, FrostWire, gtk-gnutella, Installous (iOS app), I2P, KTorrent, MLDonkey, Morpheus, Qbittorrent, rTorrent, Shareaza, Tixati, Transmission, Tribler and Vuze.

The Pirate Bay migrated from .torrent files to magnet URI in February 2012. This migration made the storage footprint of The Pirate Bay exceptionally small. A user demonstrated total size of The Pirate Bay magnets would be approximately 90MB of compressed data.

Use of content hashes

The most common use of Magnet URIs is to point to a particular file based on a hash of its contents, producing a unique identifier for the file, similar to an ISBN or catalog number. Unlike traditional identifiers, however, content-based signatures can be generated by anyone who already has the file, without the need for a central authority to issue them. This makes them popular for use as "guaranteed" search terms within the file sharing community where anyone can distribute a Magnet link to ensure that the resource retrieved by that link is the one intended, regardless of how it is retrieved. While it is theoretically possible for two files to have the same hash value (known as a "hash collision"), cryptographic hash functions are designed to reduce that occurrence to a practical impossibility -- even if an expert with vast computational resources is intentionally looking for two files with the same hash value.

Another advantage of Magnet URIs is their open nature and platform independence: the same Magnet link can be used to download a resource from numerous applications on almost any operating system. Because they are concise and plain-text, users can copy-and-paste them into e-mails or instant messages, a property not found in, for example, BitTorrent files.

Technical description

Magnet URIs consist of a series of one or more parameters, the order of which is not significant, formatted in the same way as query strings that ordinarily terminate HTTP URLs. The most common parameter is "xt" ("exact topic"), which is generally a URN formed from the content hash of a particular file, e.g..

magnet:?xt=urn:sha1:YNCKHTQCWBTRNJIV4WNA
­E52SJUQCZO5C

This refers to the Base32 encoded SHA-1 hash of the file in question. Note that, although a particular file is indicated, an availability search for it must still be carried out by the client application.

Other parameters defined by the draft standard are:

"dn" ("display name"): a filename to display to the user, for convenience

"kt" ("keyword topic"): a more general search, specifying search terms, rather than a particular file

"mt" ("manifest topic"): a URI pointing to a "manifest", e.g. a list of further items

application-specific experimental parameters, which must begin "x."

The standard also allows for multiple parameters of the same type to be used by appending ".1", ".2", etc. to the parameter name, e.g.: magnet:?xt.1=urn:sha1:YNCKHTQCWBTRNJIV4W­NAE52SJUQCZO5C&xt.2=urn:

Image source and copyright details: http://wikipedia.org/wiki/File:Magnet...
Original article available at http://en.wikipedia.org/wiki/Magnet_U...

No comments:

Post a Comment