Changeset 10808

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

removing 64-bit key limitation and going to 160-bit since this matches the length of a sha-1 digest.

Files:
1 modified

Legend:

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

    r10807 r10808  
    8686be of arbitrary length and is sent in plaintext. 
    8787 
    88 If the tracker sends no initialization vector then the first 64-bits 
    89 of the infohash are used as the RC4 key.  If the tracker provides an 
     88If the tracker sends no initialization vector then the infohash is 
     89used as the RC4 key (160 bit key).  If the tracker provides an 
    9090initialization vector then the RC4 key is generated by appending the 
    91 vector to the infohash and then hashing with SHA-1.  The first 64 bits 
    92 of the resulting hash are then used as the RC4 key.  The string from 
    93 which the RC4 key is derived whether it be the infohash or the SHA-1 of 
    94 the initialization vector appended to the infohash is called the 
     91vector to the infohash and then hashing with SHA-1.  The resulting 
     92hash is then used as the RC4 key.  The string from which the RC4 key 
     93is derived whether it be the infohash or the SHA-1 of the 
     94initialization vector appended to the infohash is called the 
    9595*intermediate string*. 
    9696 
     
    101101:: 
    102102  
    103    intermediate = sha1( 'aaf4c61ddcc5e8a2dabedef3b482cd9aea9434dabcd' ) 
    104    key = intermediate[0:64] 
    105  
    106 where [i:j] denotes the ith through *jth* bit including the *ith* but 
    107 excluding the *jth*.  The resulting key in hex is ``f36e9cae87cf33e0``. 
    108  
    109 A 64-bit key is used to avoid U.S. export restrictions.  
     103   key = sha1( 'aaf4c61ddcc5e8a2dabedef3b482cd9aea9434dabcd' ) 
     104 
     105where [i:j] denotes the *ith* through *jth* bit including the *ith* 
     106but excluding the *jth*.  The resulting key in hex is 
     107``f36e9cae87cf33e07645ef5ca745a8a83469f31e``. 
    110108 
    111109It is RECOMMENDED that the tracker use the initialization vector, and 
     
    258256return the desired number of peers then it MAY include peers that are 
    259257not assumed to support MSE.  If a peer closes a connection in response 
    260 to an encrypted header then the initiating peer SHOULD try other peers 
    261 in the peer list returning to the peer that closed the connection only 
    262 when all other peers known or not yet known to support MSE have been 
    263 tried and have failed to provide "adequate performance."  We 
     258to an encrypted header then the initiating peer SHOULD assume that the 
     259peer does not support MSE.  The initiating peer however SHOULD ONLY 
     260initiate unencrypted connections when all peers have been tried and 
     261those that support MSE fail to provide "adequate performance."  We 
    264262intentionally omit any definition of "adequate performance." 
    265263 
     
    428426    global iv, x, n, n_xor_y, obfuscated_tracker_peer_list 
    429427    iv = rand(20) 
    430     rc4.key = sha(infohash + iv).digest()[0:8] 
     428    rc4.key = sha(infohash + iv).digest() 
    431429    rc4(768)                         # discard first 768 
    432430    x = rc4(4)