import hashlib
import base64


def compute_sri_hash(filename, block_size=4096):
    """
    Compute a SRI-compliant hash with SHA256
    :param filename: path to the file
    :param block_size: size of the block for reading binary data
    :return: a base64-encoded hash
    """
    sha256_hash = hashlib.sha256()
    with open(filename, "rb") as f:
        for block in iter(lambda: f.read(block_size), b""):
            sha256_hash.update(block)
        b64_encoded_str = base64.b64encode(sha256_hash.digest())
        return b64_encoded_str.decode()