mirror of
https://github.com/arsenetar/dupeguru.git
synced 2025-03-10 05:34:36 +00:00
[#75 state:fixed] md5 hashes are now computed incrementally.
This commit is contained in:
parent
d62ff40bed
commit
9f006ec08a
@ -102,8 +102,12 @@ class File(object):
|
|||||||
elif field == 'md5':
|
elif field == 'md5':
|
||||||
try:
|
try:
|
||||||
fp = io.open(self.path, 'rb')
|
fp = io.open(self.path, 'rb')
|
||||||
filedata = fp.read()
|
md5 = hashlib.md5()
|
||||||
md5 = hashlib.md5(filedata)
|
CHUNK_SIZE = 8192
|
||||||
|
filedata = fp.read(CHUNK_SIZE)
|
||||||
|
while filedata:
|
||||||
|
md5.update(filedata)
|
||||||
|
filedata = fp.read(CHUNK_SIZE)
|
||||||
self.md5 = md5.digest()
|
self.md5 = md5.digest()
|
||||||
fp.close()
|
fp.close()
|
||||||
except Exception:
|
except Exception:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user