import hashlib


def generate_file_sh256(filename, blocksize=2 ** 20):
    """
    Generates the SHA_256 hashsum of the given file
    @param filename: name of the file, the hashsum will calculated for
    @param blocksize: blocksize used during calculation
    """
    m = hashlib.sha256()
    with open(filename, "rb") as f:
        while True:
            buf = f.read(blocksize)
            if not buf:
                break
            m.update(buf)
    return m.hexdigest()