Commit 040df5cc by Szeberényi Imre

Checksum fix

parent fc13dc82
...@@ -59,9 +59,12 @@ class Disk(object): ...@@ -59,9 +59,12 @@ class Disk(object):
@property @property
def checksum(self, blocksize=65536): def checksum(self, blocksize=65536):
logging.debug("Generating checksum for %s", self.get_path())
hash = md5() hash = md5()
with open(self.get_path(), "rb") as f: with open(self.get_path(), "rb") as f:
for block in iter(lambda: f.read(blocksize), ""): for block in iter(lambda: f.read(blocksize), ""):
if len(block) == 0:
break
hash.update(block) hash.update(block)
return hash.hexdigest() return hash.hexdigest()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment