hashdd.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:pyhashdd 作者: hashdd 项目源码 文件源码
def _generate_hashes(self):
        if self._buffer is None:
            raise Exception('No buffer provided, nothing to do')

        algos = list(hashlib.algorithms)
        for a in algorithm.__subclasses__():
            algos.append(a.__name__)

        for module in algos:
            """To support validation within each algorithm's
            module, we wrap an existing implementation
            and name it with the 'hashdd_' prefix to avoid conflicts.
            We're not going to strip this prefix until the very last moment
            as common hashes like md5 may be used in a variety of places
            """
            if self._algorithms is not None and module not in self._algorithms:
                # Skip modules that are not expressly enabled
                continue

            if module.startswith('hashdd_'):
                m = getattr(hashlib, module)
                if m.prefilter(self._buffer):
                    setattr(self, module[7:], m(self._buffer).hexdigest())
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号