Commit bccebcfd by Guba Sándor

fix checksum

parent 785fede2
...@@ -53,8 +53,12 @@ class Disk(object): ...@@ -53,8 +53,12 @@ class Disk(object):
self.base_name = base_name self.base_name = base_name
@property @property
def checksum(self): def checksum(self, blocksize=65536):
return md5(self.get_path()).hexdigest() hash = md5()
with open(self.get_path(), "r+b") as f:
for block in iter(lambda: f.read(blocksize), ""):
hash.update(block)
return hash.hexdigest()
@classmethod @classmethod
def deserialize(cls, desc): def deserialize(cls, desc):
......
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