-
Notifications
You must be signed in to change notification settings - Fork 49
/
index.html
201 lines (179 loc) · 10.1 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta name="description" content="Convert torrent files to magnet URIs using Javascript" />
<meta name="keywords" content="torrent,magnet,javascript,convert,online,sha1,bencode,base32" />
<meta name="author" content="nutbread" />
<title>Torrent to Magnet</title>
<link rel="shortcut icon" href="favicon.png" />
<link rel="stylesheet" href="style.css" />
<script src="src/t2m.loader.js"></script>
</head>
<body>
<div class="header_bar">
<div class="main main_no_overflow header">
<table class="header_table"><tbody>
<tr>
<td class="header_table_cell">
<div class="header_table_name">
<a class="header_table_name_user link_external link_author light_underline" href="https://nutbread.github.io/"><span>nutbread</span></a><span class="header_table_name_separator">/</span><a href="" class="header_table_name_title link_external link_title light_underline"><span>t2m</span></a>
</div>
</td>
<td class="header_table_cell">
<div class="header_table_separator"></div>
</td>
<td class="header_table_cell header_table_cell_full">
<div class="header_table_description">
<div class="header_table_description_name">Torrent to Magnet</div>
<div class="header_table_description_body">Javascript implementation of magnet URI conversion</div>
</div>
</td>
<td class="header_table_cell">
<a class="header_table_view_on_github link_external link_view_on_github light_nohover_color_hover" href="https://github.com/nutbread/t2m">
<div class="header_table_view_on_github_line1">view on</div>
<div class="header_table_view_on_github_line2">github</div>
</a>
</td>
</tr>
</tbody></table>
</div>
</div>
<div class="main body">
<h1 id="converter"><span class="section_id" id="converter.exclusive"><span class="hardlink_text">Converter<a class="hardlink" href="#converter"></a></span><label class="converter_exclusive_mode script_enabled"><input type="checkbox" class="converter_exclusive_mode_check checkbox" /><span class="converter_exclusive_mode_text"></span></label></span></h1>
<p>
<div class="script_disabled script_visible">
Javascript is required to use the inline converter.
</div>
<div class="script_enabled">
<div class="converter">
<div class="converter_container">
<div class="converter_table">
<div class="converter_cell converter_cell_left">
<div class="converter_svg_container">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1 1" class="converter_svg_graphic">
<polygon points="0.7,0 0.7,0.5 1,0.5 0.5,1 0,0.5 0.3,0.5 0.3,0" class="converter_svg_graphic_poly"></polygon>
</svg>
</div>
</div>
<div class="converter_cell converter_cell_right">
<div class="converter_info">
<div class="converter_info_line1">Drop <a class="link_external light_underline link_stop_propagation" href="https://en.wikipedia.org/wiki/Torrent_file" target="_blank"><span>.torrent</span></a> files here</div>
<div class="converter_info_line2">to convert them to <a class="link_external light_underline link_stop_propagation" href="https://en.wikipedia.org/wiki/Magnet_uri" target="_blank"><span>magnet URI</span></a>s</div>
<div class="converter_info_line3">Or click to open the file browser</div>
<input type="file" class="converter_files_input" multiple />
</div>
</div>
</div>
</div>
</div>
</div>
</p>
<div class="converted"></div>
<div class="non_exclusive">
<h1 id="libraries"><span class="hardlink_text">Libraries<a class="hardlink" href="#libraries"></a></span></h1>
<p>
The following Javascript libraries are used on this page:
</p>
<p>
<ul>
<li>
<a class="link_codebase light_underline" href="https://github.com/nutbread/t2m/blob/gh-pages/src/sha1.js" target="_blank"><span>sha1.js</span></a> - <a class="link_external light_underline" href="https://en.wikipedia.org/wiki/SHA-1" target="_blank"><span>SHA-1</span></a> hashing library
</li>
<li>
<a class="link_codebase light_underline" href="https://github.com/nutbread/t2m/blob/gh-pages/src/bencode.js" target="_blank"><span>bencode.js</span></a> - <a class="link_external light_underline" href="https://en.wikipedia.org/wiki/Bencode" target="_blank"><span>Bencode</span></a> encoding/decoding library
</li>
<li>
<a class="link_codebase light_underline" href="https://github.com/nutbread/t2m/blob/gh-pages/src/base32.js" target="_blank"><span>base32.js</span></a> - <a class="link_external light_underline" href="https://en.wikipedia.org/wiki/Base32" target="_blank"><span>Base32</span></a> encoding/decoding library
</li>
</ul>
</p>
<p>
They are primarly designed for web usage, but they can be trivially modified to be used with something such as <a class="link_external light_underline" href="http://nodejs.org/" target="_blank"><span>node.js</span></a>.
</p>
<h4 id="sha1.js"><span class="hardlink_text">sha1.js<a class="hardlink" href="#sha1.js"></a></span></h4>
<p>
Computes the <a class="link_external light_underline" href="https://en.wikipedia.org/wiki/SHA-1" target="_blank"><span>SHA-1</span></a> hash of the specified data using the basic algorithm described in <a class="link_external light_underline" href="https://tools.ietf.org/html/rfc3174" target="_blank"><span>RFC 3174</span></a>, with a paradigm similar to <a class="link_external light_underline" href="https://docs.python.org/2/library/hashlib.html" target="_blank"><span>python's hashlib</span></a>. Data can be input in chunks, and the digest can be calculated at any point without modifying the internal state.
</p>
<h6 id="sha1.js.interface"><span class="hardlink_text">Public interface<a class="hardlink" href="#sha1.js.interface"></a></span></h6>
<p>
The following are public methods on the <code>SHA1</code> class:<br />
<ul>
<li>
<code><strong><em>constructor</em></strong>()</code><br />
Creates a new <code>SHA1</code> hashing instance.
</li>
<li>
<code><strong>reset</strong>()</code><br />
Resets the internal state of the instance.
</li>
<li>
<code><strong>update</strong>(value_array)</code><br />
Update the internal state of the hashing object with the values contained in <code>value_array</code>.<br />
<code>value_array</code> can be a string, with each character in the range <code>[0,255]</code>; or a (<a class="link_external light_underline" href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Typed_arrays" target="_blank"><span>typed</span></a>) array, with each value in the range <code>[0,255]</code>.
</li>
<li>
<code><strong>digest</strong>() <span class="light">: Uint8Array</span></code><br />
Computes and returns the SHA1 digest of all the data input so far. The return value is a <code><a class="link_external light_underline" href="https://developer.mozilla.org/en-US/docs/Web/API/Uint8Array" target="_blank"><span>Uint8Array</span></a></code> of length <code>20</code>.
</li>
</ul>
</p>
<h4 id="bencode.js"><span class="hardlink_text">bencode.js<a class="hardlink" href="#bencode.js"></a></span></h4>
<p>
Encode/decode an object or string using the <a class="link_external light_underline" href="https://en.wikipedia.org/wiki/Bencode" target="_blank"><span>Bencode</span></a> format.
</p>
<h6 id="bencode.js.interface"><span class="hardlink_text">Public interface<a class="hardlink" href="#bencode.js.interface"></a></span></h6>
<p>
The following are public methods on the <code>Bencode</code> module:<br />
<ul>
<li>
<code><strong>encode</strong>(obj) <span class="light">: string</span></code><br />
Encode <code>obj</code> into a Bencoded string.<br />
<code>obj</code> can only be a string, number, array, or object. Arrays and objects can also only contain the aforementioned types.
</li>
<li>
<code><strong>decode</strong>(str) <span class="light">: [object | array | string | number]</span></code><br />
<em>throws <code>"Invalid format"</code></em><br />
Converts Bencoded <code>str</code> back into its original type. If data is malformed, an exception is thrown.
</li>
</ul>
</p>
<h4 id="base32.js"><span class="hardlink_text">base32.js<a class="hardlink" href="#base32.js"></a></span></h4>
<p>
Encode/decode a string using the <a class="link_external light_underline" href="https://tools.ietf.org/html/rfc4648" target="_blank"><span>RFC 4648</span></a> <a class="link_external light_underline" href="https://en.wikipedia.org/wiki/Base32" target="_blank"><span>Base32</span></a> format.
</p>
<h6 id="base32.js.interface"><span class="hardlink_text">Public interface<a class="hardlink" href="#base32.js.interface"></a></span></h6>
<p>
The following are public methods on the <code>Base32</code> module:<br />
<ul>
<li>
<code><strong>encode</strong>(str) <span class="light">: string</span></code><br />
Encode <code>str</code> into Base32.
</li>
<li>
<code><strong>decode</strong>(str) <span class="light">: string</span></code><br />
Decode <code>str</code> from Base32 into its original string.
</li>
</ul>
</p>
<h1 id="javascript"><span class="hardlink_text">Other Javascript files<a class="hardlink" href="#javascript"></a></span></h1>
<p>
These are the other Javascript files included in this repository:
</p>
<p>
<ul>
<li>
<a class="link_codebase light_underline" href="https://github.com/nutbread/t2m/blob/gh-pages/src/sha1.test.js" target="_blank"><span>sha1.test.js</span></a> - Test case file similar to the one <a class="link_external light_underline" href="https://tools.ietf.org/html/rfc3174#section-7.3" target="_blank"><span>here</span></a>
</li>
<li>
<a class="link_codebase light_underline" href="https://github.com/nutbread/t2m/blob/gh-pages/src/t2m.loader.js" target="_blank"><span>t2m.loader.js</span></a> - The loader file used to set up this page
</li>
<li>
<a class="link_codebase light_underline" href="https://github.com/nutbread/t2m/blob/gh-pages/src/t2m.js" target="_blank"><span>t2m.js</span></a> - The main file used to process .torrent files on this page
</li>
</ul>
</p>
</div>
</div>
</body>
</html>