Skip to content

Commit

Permalink
add file hashing
Browse files Browse the repository at this point in the history
  • Loading branch information
hammannr committed Oct 4, 2024
1 parent 2ff9da0 commit c60ba7f
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions alea/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -700,6 +700,15 @@ def deterministic_hash(thing, length=10):
return b32encode(digest)[:length].decode("ascii").lower()


def compute_file_hash(file_path: str) -> str:
"""Compute the SHA-256 hash of a file."""
hash_sha256 = sha256()
with open(file_path, "rb") as f:
for chunk in iter(lambda: f.read(4096), b""):
hash_sha256.update(chunk)
return hash_sha256.hexdigest()


def signal_multiplier_estimator(
signal: np.ndarray,
background: np.ndarray,
Expand Down

0 comments on commit c60ba7f

Please sign in to comment.