coder.py 文件源码

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

项目:00scanner 作者: xiaoqin00 项目源码 文件源码
def hash(self, method="md5"):
        '''
        ??hash??
        '''
        content = open(self._fileName,"rb").read(self._MAXSIZE)
        if method == "md5":
            return hashlib.md5(content).hexdigest()
        if method == "sha" or method == "sha1":
            return hashlib.sha1(content).hexdigest()
        if method == "sha224":
            return hashlib.sha224(content).hexdigest()
        if method == "sha256":
            return hashlib.sha256(content).hexdigest()
        if method == "sha384":
            return hashlib.sha384(content).hexdigest()
        if method == "sha512":
            return hashlib.sha512(content).hexdigest()
        if method == "crc32":
            return "{0:x}".format(binascii.crc32(content) & 0xffffffff)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号