summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2017-10-27 20:28:50 +0200
committerMichał Górny <mgorny@gentoo.org>2017-10-27 20:32:43 +0200
commit948ed8eff9c98df8b11c292486f42308da179f64 (patch)
tree6ca9ba2fa92dff9c695212508735732808e20273
parent45e233ed6cc4da3770956d904024ba60327e7701 (diff)
downloadgemato-948ed8eff9c98df8b11c292486f42308da179f64.tar.gz
hash: Use read1() instead of read() to read buffer
Most likely this has no practical implications but read1() avoids unnecessary internal loop to fill the buffer completely.
-rw-r--r--gemato/hash.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/gemato/hash.py b/gemato/hash.py
index 789f886..a5b3074 100644
--- a/gemato/hash.py
+++ b/gemato/hash.py
@@ -73,7 +73,7 @@ def hash_file(f, hash_names):
hashes = {}
for h in hash_names:
hashes[h] = get_hash_by_name(h)
- for block in iter(lambda: f.read(HASH_BUFFER_SIZE), b''):
+ for block in iter(lambda: f.read1(HASH_BUFFER_SIZE), b''):
for h in hashes.values():
h.update(block)
return dict((k, h.hexdigest()) for k, h in hashes.items())