stouputils.backup.hash module#

get_file_hash(file_path: str) str | None[source]#

Computes the SHA-256 hash of a file.

Parameters:

file_path (str) – Path to the file

Returns:

SHA-256 hash as a hexadecimal string or None if an error occurs

Return type:

str | None

extract_hash_from_zipinfo(
zip_info: ZipInfo,
) str | None[source]#

Extracts the stored hash from a ZipInfo object’s comment.

Parameters:

zip_info (zipfile.ZipInfo) – The ZipInfo object representing a file in the ZIP

Returns:

The stored hash if available, otherwise None

Return type:

str | None