diff options
author | Joakim Bech <joakim.bech@linaro.org> | 2016-08-29 23:45:06 +0200 |
---|---|---|
committer | Joakim Bech <joakim.bech@linaro.org> | 2016-08-29 23:45:06 +0200 |
commit | 2ddfd8a650d544b2c8d56d28a02a9d3ff355ae2f (patch) | |
tree | 3c0dd6148371c721082c401dc09a9e21188bb003 | |
parent | 671d349424fa7e8411198d0a97aeed193b5c4a72 (diff) |
Read whole file at once when hashing
Signed-off-by: Joakim Bech <joakim.bech@linaro.org>
-rwxr-xr-x | patch_mynewt_img.py | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/patch_mynewt_img.py b/patch_mynewt_img.py index f77b4e7..7f407b6 100755 --- a/patch_mynewt_img.py +++ b/patch_mynewt_img.py @@ -59,8 +59,7 @@ def extend_image(img, img_size): def calculate_hash(img): sha256 = hashlib.sha256() with open(img + ".img", "rb") as f: - for chunk in iter(lambda: f.read(4096), b""): - sha256.update(chunk) + sha256.update(f.read()) return sha256.hexdigest() |