Changeset 10809

Show
Ignore:
Timestamp:
02/15/08 00:49:49 (2 years ago)
Author:
dave
Message:

generated bep_0008 reflecting removal of 64-bit limit on key.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • dotorg/trunk_fixed/html/beps/bep_0008.html

    r10763 r10809  
    3838<tr class="field"><th class="field-name">Title:</th><td class="field-body">Tracker Peer Obfuscation</td> 
    3939</tr> 
    40 <tr class="field"><th class="field-name">Version:</th><td class="field-body">10762</td> 
    41 </tr> 
    42 <tr class="field"><th class="field-name">Last-Modified:</th><td class="field-body"><a class="reference external" href="https://svn.bittorrent.com/trac.cgi/browser/dotorg/trunk/html/beps/bep_0008.rst">2008-02-14 13:37:25 -0800 (Thu, 14 Feb 2008)</a></td> 
     40<tr class="field"><th class="field-name">Version:</th><td class="field-body">10808</td> 
     41</tr> 
     42<tr class="field"><th class="field-name">Last-Modified:</th><td class="field-body"><a class="reference external" href="https://svn.bittorrent.com/trac.cgi/browser/dotorg/trunk/html/beps/bep_0008.rst">2008-02-15 00:46:13 -0800 (Fri, 15 Feb 2008)</a></td> 
    4343</tr> 
    4444<tr class="field"><th class="field-name">Author:</th><td class="field-body">David Harrison &lt;dave&#32;&#97;t&#32;bittorrent.com&gt;, Anthony Ciani &lt;tony&#32;&#97;t&#32;ciani.phy.uic.edu&gt;, Arvid Norberg &lt;arvid&#32;&#97;t&#32;bittorrent.com&gt;, Greg Hazel &lt;greg&#32;&#97;t&#32;bittorrent.com&gt;</td> 
     
    8282<h1>Announce Parameter</h1> 
    8383<p>When using this extension, instead of passing the <tt class="docutils literal"><span class="pre">info_hash</span></tt> parameter 
    84 to the tracker, an <tt class="docutils literal"><span class="pre">sha_ih</span></tt> is passed.</p> 
     84to the tracker, a <tt class="docutils literal"><span class="pre">sha_ih</span></tt> is passed.</p> 
    8585<p>The value of <tt class="docutils literal"><span class="pre">sha_ih</span></tt> MUST be the info-hash of the torrent, with a second 
    8686SHA-1 applied to it.</p> 
     
    9696<div class="section" id="announce-response"> 
    9797<h1>Announce Response</h1> 
    98 <p>If the tracker supports this extension, the response should be exactly the 
    99 same as if the <tt class="docutils literal"><span class="pre">info_hash</span></tt> was passed, except that any field that contains 
    100 peer information (such as <tt class="docutils literal"><span class="pre">peers</span></tt>, <tt class="docutils literal"><span class="pre">peers6</span></tt> or any other field defined 
    101 by another extension) MUST be obfuscated as described in the next section.</p> 
     98<p>If the tracker supports this extension, the response should be exactly 
     99the same as if the <tt class="docutils literal"><span class="pre">info_hash</span></tt> had been passed, except that any 
     100field that contains peer information (such as <tt class="docutils literal"><span class="pre">peers</span></tt>, <tt class="docutils literal"><span class="pre">peers6</span></tt> or 
     101any other field defined by another extension) MUST be obfuscated as 
     102described in the next section.</p> 
    102103<p>There are additional parameters the tracker may OPTIONALLY return. 
    103104These are discussed in the <a class="reference internal" href="#optimizations">optimizations</a> section.</p> 
     
    107108<p>We distinguish between the <em>tracker peer list</em> and the <em>returned peer 
    108109list</em>.  The <em>tracker peer list</em> contains the ip-port pairs of all 
    109 known peers in a given torrent, i.e., those peers that have reported to 
    110 the tracker that they are downloading or seeding a given file with a 
    111 given infohash.  The tracker may store this peer list however it 
    112 wishes.  The <em>returned peer list</em> contains a packed array of ip-port 
    113 pairs conforming to the BitTorrent protocol specification.  If the 
    114 swarm is sufficiently large then the returned ip-port pairs constitute 
    115 a subset of the ip-port pairs in the <em>tracker peer list</em>.</p> 
     110known peers in a given torrent, i.e., those peers that have reported 
     111to the tracker that they are transferring the file with a given 
     112infohash.  The tracker may store this peer list however it wishes. 
     113The <em>returned peer list</em> contains a packed array of ip-port pairs 
     114conforming to the BitTorrent protocol specification.  If the swarm is 
     115sufficiently large then the returned ip-port pairs constitute a subset 
     116of the ip-port pairs in the <em>tracker peer list</em>.</p> 
    116117<p>The returned peer list is encrypted using RC4-drop768 encryption using 
    117118the infohash as a shared secret and optionally employing an 
     
    129130containing the initialization vector.  The initialization vector can 
    130131be of arbitrary length and is sent in plaintext.</p> 
    131 <p>If the tracker sends no initialization vector then the first 64-bits 
    132 of the infohash are used as the RC4 key.  If the tracker provides an 
     132<p>If the tracker sends no initialization vector then the infohash is 
     133used as the RC4 key (160 bit key).  If the tracker provides an 
    133134initialization vector then the RC4 key is generated by appending the 
    134 vector to the infohash and then hashing with SHA-1.  The first 64 bits 
    135 of the resulting hash are then used as the RC4 key.  The string from 
    136 which the RC4 key is derived whether it be the infohash or the SHA-1 of 
    137 the initialization vector appended to the infohash is called the 
     135vector to the infohash and then hashing with SHA-1.  The resulting 
     136hash is then used as the RC4 key.  The string from which the RC4 key 
     137is derived whether it be the infohash or the SHA-1 of the 
     138initialization vector appended to the infohash is called the 
    138139<em>intermediate string</em>.</p> 
    139140<p>For example, given infohash <tt class="docutils literal"><span class="pre">aaf4c61ddcc5e8a2dabedef3b482cd9aea9434d</span></tt> 
     
    141142is derived as follows:</p> 
    142143<pre class="literal-block"> 
    143 intermediate = sha1( 'aaf4c61ddcc5e8a2dabedef3b482cd9aea9434dabcd' ) 
    144 key = intermediate[0:64] 
     144key = sha1( 'aaf4c61ddcc5e8a2dabedef3b482cd9aea9434dabcd' ) 
    145145</pre> 
    146 <p>where [i:j] denotes the ith through <em>jth</em> bit including the <em>ith</em> but 
    147 excluding the <em>jth</em>.  The resulting key in hex is <tt class="docutils literal"><span class="pre">f36e9cae87cf33e0</span></tt>.</p> 
    148 <p>A 64-bit key is used to avoid U.S. export restrictions.</p> 
     146<p>where [i:j] denotes the <em>ith</em> through <em>jth</em> bit including the <em>ith</em> 
     147but excluding the <em>jth</em>.  The resulting key in hex is 
     148<tt class="docutils literal"><span class="pre">f36e9cae87cf33e07645ef5ca745a8a83469f31e</span></tt>.</p> 
    149149<p>It is RECOMMENDED that the tracker use the initialization vector, and 
    150150that it change the <tt class="docutils literal"><span class="pre">iv</span></tt> on roughly the same period as the rerequest 
     
    275275return the desired number of peers then it MAY include peers that are 
    276276not assumed to support MSE.  If a peer closes a connection in response 
    277 to an encrypted header then the initiating peer SHOULD try other peers 
    278 in the peer list returning to the peer that closed the connection only 
    279 when all other peers known or not yet known to support MSE have been 
    280 tried and have failed to provide &quot;adequate performance.&quot;  We 
     277to an encrypted header then the initiating peer SHOULD assume that the 
     278peer does not support MSE.  The initiating peer however SHOULD ONLY 
     279initiate unencrypted connections when all peers have been tried and 
     280those that support MSE fail to provide &quot;adequate performance.&quot;  We 
    281281intentionally omit any definition of &quot;adequate performance.&quot;</p> 
    282282</div> 
     
    450450  global iv, x, n, n_xor_y, obfuscated_tracker_peer_list 
    451451  iv = rand(20) 
    452   rc4.key = sha(infohash + iv).digest()[0:8] 
     452  rc4.key = sha(infohash + iv).digest() 
    453453  rc4(768)                         # discard first 768 
    454454  x = rc4(4)