Skip to content

Commit

Permalink
watcher-py: shasum portability
Browse files Browse the repository at this point in the history
  • Loading branch information
Will committed Jul 16, 2024
1 parent d979dd5 commit 09bf85f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions tool/shasum.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 09bf85f

Please sign in to comment.