diff --git a/avocado/utils/crypto.py b/avocado/utils/crypto.py index ce64bd119eb623a47e28375c4cb704accf90c1e4..93f3ab8ea56fbfc8fd581f49b2c64a443b80b64c 100644 --- a/avocado/utils/crypto.py +++ b/avocado/utils/crypto.py @@ -66,11 +66,11 @@ def hash_file(filename, size=None, algorithm="md5"): while size > 0: if chunksize > size: chunksize = size - data = file_to_hash.read(chunksize) - if len(data) == 0: - logging.debug("Nothing left to read but size=%d", size) - break - hash_obj.update(data) - size -= len(data) + data = file_to_hash.read(chunksize) + if len(data) == 0: + logging.debug("Nothing left to read but size=%d", size) + break + hash_obj.update(data) + size -= len(data) return hash_obj.hexdigest()