Torrent to Magnet
Javascript implementation of magnet URI conversion
|
view on
github
|
The following Javascript libraries are used on this page:
They are primarly designed for web usage, but they can be trivially modified to be used with something such as node.js.
Computes the SHA-1 hash of the specified data using the basic algorithm described in RFC 3174, with a paradigm similar to python's hashlib. Data can be input in chunks, and the digest can be calculated at any point without modifying the internal state.
The following are public methods on the SHA1
class:
constructor()
SHA1
hashing instance.
reset()
update(value_array)
value_array
.value_array
can be a string, with each character in the range [0,255]
; or a (typed) array, with each value in the range [0,255]
.
digest() : Uint8Array
Uint8Array
of length 20
.
Encode/decode an object or string using the Bencode format.
The following are public methods on the Bencode
module:
encode(obj) : string
obj
into a Bencoded string.obj
can only be a string, number, array, or object. Arrays and objects can also only contain the aforementioned types.
decode(str) : [object | array | string | number]
"Invalid format"
str
back into its original type. If data is malformed, an exception is thrown.
Encode/decode a string using the RFC 4648 Base32 format.
The following are public methods on the Base32
module:
encode(str) : string
str
into Base32.
decode(str) : string
str
from Base32 into its original string.
These are the other Javascript files included in this repository: