MCPcopy Create free account
hub / github.com/BruceDevices/firmware / hash_file

Function hash_file

patch.py:62–69  ·  view source on GitHub ↗

Generate SHA-256 hash for a single file.

(file_path)

Source from the content-addressed store, hash-verified

60
61
62def hash_file(file_path):
63 """Generate SHA-256 hash for a single file."""
64 hasher = hashlib.sha256()
65 with open(file_path, "rb") as f:
66 # Read the file in chunks to avoid memory issues
67 for chunk in iter(lambda: f.read(4096), b""):
68 hasher.update(chunk)
69 return hasher.hexdigest()
70
71
72def hash_files(file_paths):

Callers 1

hash_filesFunction · 0.85

Calls 3

sha256Method · 0.80
readMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected