def gethash(path, filename):
scanfile = open("%s/%s" % (path, filename), 'r')
h = hashlib.new('sha256')
scanfile.seek(0)
hashdata = scanfile.read(10000000)
while hashdata != '':
h.update(hashdata)
hashdata = scanfile.read(10000000)
scanfile.close()
return h.hexdigest()
## method to compare binaries. Returns the amount of bytes that differ
## according to bsdiff, or 0 if the files are identical
评论列表
文章目录