import hashlib


def hash_file(pathname):
    """Returns a byte string that is the SHA-256 hash of the file at the given pathname."""
    h = hashlib.sha256()
    with open(pathname, 'rb') as ifile:
        h.update(ifile.read())
    return h.digest()