files.py 232 B

12345678910111213
  1. import hashlib
  2. __all__ = (
  3. 'sha256_hash',
  4. )
  5. def sha256_hash(filepath):
  6. """
  7. Return the SHA256 hash of the file at the specified path.
  8. """
  9. with open(filepath, 'rb') as f:
  10. return hashlib.sha256(f.read())