md5checksum.py 文件源码

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

项目:darkc0de-old-stuff 作者: tuwid 项目源码 文件源码
def compute_md5(prefix, filename, files_done, files_total, bytes_done, 
                bytes_total, suffix):
    m = md5.new()
    f = open(filename, "rb")
    while 1:
    data = f.read(4*1024)
    if not data:
        break
    m.update(data)
    bytes_done += len(data)
        print_timed_status(("%s: file %d of %d, %s of %s, " +
                            "%d %% done%s") %
               (prefix, files_done + 1, 
               files_total, 
               format_size(bytes_done),
               format_size(bytes_total),
               100.0 * float(bytes_done) / bytes_total, 
               suffix))
    f.close()
    return m.hexdigest(), bytes_done


# Figure out the total size of a set of files.
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号