utils.file_sha256()

Compute the SHA-256 hex digest of a file, reading it in chunks.

Usage

Source

utils.file_sha256(
    path,
    *,
    chunk_size=_HASH_CHUNK_SIZE,
)

Parameters

path: str or Path

File to hash.

chunk_size: int = _HASH_CHUNK_SIZE
Number of bytes to read per iteration. Defaults to 1 MiB.

Returns

str
The lowercase hexadecimal SHA-256 digest.