Exemplo n.º 1
0
 /// <summary>
 /// Creates a torrent and populates the <see cref="OriginalInfoHash"/> and <see cref="OriginalInfoHashBytes"/>
 /// properties from the provided <see cref="BDictionary"/>.
 /// </summary>
 /// <param name="originalInfoDictionary"></param>
 internal Torrent(BDictionary originalInfoDictionary)
 {
     OriginalInfoHashBytes = TorrentUtil.CalculateInfoHashBytes(originalInfoDictionary);
     OriginalInfoHash      = TorrentUtil.BytesToHexString(OriginalInfoHashBytes);
 }
Exemplo n.º 2
0
 /// <summary>
 /// Calculates the info hash of the torrent. This is used when communicating with trackers.
 /// The info hash is a 20-byte SHA1 hash of the value of the 'info' <see cref="BDictionary"/> of the torrent.
 /// </summary>
 /// <returns>A 20-byte SHA1 hash of the value of the 'info' part</returns>
 public virtual byte[] GetInfoHashBytes() => TorrentUtil.CalculateInfoHashBytes(this);