From 948ed8eff9c98df8b11c292486f42308da179f64 Mon Sep 17 00:00:00 2001 From: Michał Górny Date: Fri, 27 Oct 2017 20:28:50 +0200 Subject: 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. --- gemato/hash.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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()) -- cgit v1.2.3