From 09bf85fb3f870d8814df8e058af449a9f5a2fd29 Mon Sep 17 00:00:00 2001 From: Will Date: Mon, 15 Jul 2024 21:26:08 -0400 Subject: [PATCH] watcher-py: shasum portability --- tool/shasum.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tool/shasum.py b/tool/shasum.py index f436c3f0..d8db4e92 100644 --- a/tool/shasum.py +++ b/tool/shasum.py @@ -9,12 +9,14 @@ import sys -def sha256sum(file_path) -> str: +def sha256sum(file) -> str: """ The sha256sum of a file """ - with open(file_path, "rb") as f: - return hashlib.file_digest(f, "sha256").hexdigest() + h = hashlib.sha256() + with open(file, "rb") as f: + h.update(f.read()) + return h.hexdigest() def sha256sum_tree(path) -> dict: