MCPcopy Create free account
hub / github.com/VectifyAI/OpenKB / hash_file

Method hash_file

openkb/state.py:121–127  ·  view source on GitHub ↗

Return the SHA-256 hex digest (64 chars) of the file at path.

(path: Path)

Source from the content-addressed store, hash-verified

119
120 @staticmethod
121 def hash_file(path: Path) -> str:
122 """Return the SHA-256 hex digest (64 chars) of the file at path."""
123 h = hashlib.sha256()
124 with path.open("rb") as fh:
125 for chunk in iter(lambda: fh.read(65536), b""):
126 h.update(chunk)
127 return h.hexdigest()

Calls 1

readMethod · 0.80