def calc_size_and_sha265(content: io.IOBase, chunk_size: int):
    """Calculates the size and the sha2566 value of the content."""
    size = 0
    sha256 = hashlib.sha256()
    content.seek(0, io.SEEK_SET)
    while True:
        buf = content.read(chunk_size)
        length = len(buf)
        size += length
        sha256.update(buf)
        if length != chunk_size:
            break
    return size, sha256.hexdigest()
def calc_size_and_sha265 ( content : io . IOBase , chunk_size : int ) : size = 0 sha256 = hashlib . sha256 ( ) content . seek ( 0 , io . SEEK_SET ) while True : buf = content . read ( chunk_size ) length = len ( buf ) size += length sha256 . update ( buf ) if length != chunk_size : break return size , sha256 . hexdigest ( )
Calculates the size and the sha2566 value of the content.