INNER CODE UNIT · Python
sha256_file
IvanMurzak/Unity-MCP · .github/scripts/chain_feed.py:537
def sha256_file(path):
digest = hashlib.sha256()
with open(str(path), "rb") as handle:
for chunk in iter(lambda: handle.read(1024 * 1024), b""):
digest.update(chunk)
return digest.hexdigest()
def log(line):
print(line, flush=True)
def read_text(path):
"""Read with newline translation OFF so a CRLF file survives a surgical edit."""
with io.open(str(path), "r", encoding="utf-8", newline="") as handle:
return handle.read()