Exemple #1
0
    def _calc_info_hash(self):
        self.info_hash = None
        info_dict = self._torrent_decoded["info"]
        self.info_hash = hashlib.sha1(
            bencode.encode(info_dict)).hexdigest().upper()

        return (self.info_hash)
    def _calc_info_hash(self):
        self.info_hash = None
        info_dict = self._torrent_decoded["info"]
        self.info_hash = hashlib.sha1(bencode.encode(
            info_dict)).hexdigest().upper()

        return(self.info_hash)
Exemple #3
0
    def _calc_info_hash(self):
        self.info_hash = None
        if "info" in self._torrent_decoded:
            info_encoded = bencode.encode(self._torrent_decoded["info"])

            if info_encoded:
                self.info_hash = hashlib.sha1(info_encoded).hexdigest().upper()

        return (self.info_hash)
    def _calc_info_hash(self):
        self.info_hash = None
        if "info" in self._torrent_decoded.keys():
            info_encoded = bencode.encode(self._torrent_decoded["info"])

            if info_encoded:
                self.info_hash = hashlib.sha1(info_encoded).hexdigest().upper()

        return(self.info_hash)
Exemple #5
0
    def _calc_info_hash(self):
        if self.info_hash is not None and "info" in self._torrent_decoded.keys(
        ):
            info_encoded = bencode.encode(self._torrent_decoded["info"])

            if info_encoded:
                self.info_hash = hashlib.sha1(info_encoded).hexdigest().upper()

        return self.info_hash
Exemple #6
0
    def get_the_hash(self, filepath):
        import hashlib, StringIO
        import rtorrent.lib.bencode as bencode

        # Open torrent file
        torrent_file = open(filepath, "rb")
        metainfo = bencode.decode(torrent_file.read())
        info = metainfo['info']
        thehash = hashlib.sha1(bencode.encode(info)).hexdigest().upper()
        logger.info('Hash: ' + thehash)
        return thehash