def get_file_sha256(file):
    # as seen on the internetz
    BLOCKSIZE = 65536
    hasher = hashlib.sha256()
    with open(file, 'rb') as afile:
        buf = afile.read(BLOCKSIZE)
        while len(buf) > 0:
            hasher.update(buf)
            buf = afile.read(BLOCKSIZE)
    return hasher.hexdigest()
Get the sha256 of a file.
dataset/ETHPy150Open TheTorProject/gettor/gettor/utils.py/get_file_sha256