/** * Get info hash * * @param string $torrent Torrent * * @return string * @throws Bencode\Error\Build */ protected function getInfoHash($torrent) { $parsed_torrent = $this->parseTorrent($torrent); return sha1(Bencode\Builder::build(array('piece length' => $parsed_torrent['info']['piece length'], 'pieces' => $parsed_torrent['info']['pieces'], 'name' => $parsed_torrent['info']['name'], 'length' => $parsed_torrent['info']['length'], 'private' => $parsed_torrent['info']['private'])), true); }
/** * Creates a bencoded tracker failure message. * * @param string $message Public description of the failure. * * @return Bencode\Value\AbstractValue */ protected function trackerFailure($message) { return Bencode\Builder::build(array('failure reason' => $message)); }