import hashlib


def file_hash(filename):
    """
    Hash the contents of the specified file using SHA-256 and return the hash
    as a string.

    @param filename  The filename to hash the contents of
    @return String representing the SHA-256 hash of the file contents
    """
    hasher = hashlib.sha256()
    with open(filename, 'rb') as infp:
        while True:
            data = infp.read(8192)
            if not data:
                break
            hasher.update(data)
    return hasher.hexdigest()