absfuyu.tools.checksum module

Absufyu: Checksum

Check MD5, SHA256, …

Version: 5.1.0 Date updated: 10/03/2025 (dd/mm/yyyy)

class absfuyu.tools.checksum.Checksum(path: str | Path, hash_mode: ChecksumMode | Literal['md5', 'sha1', 'sha256', 'sha512'] = ChecksumMode.SHA256, save_result_to_file: bool = False)[source]

Bases: BaseClass

Checksum engine

Parameters:
  • path (str | Path) – Path to file/directory to perform checksum

  • hash_mode (ChecksumMode | Literal["md5", "sha1", "sha256", "sha512"], optional) – Hash mode, by default "sha256"

  • save_result_to_file (bool, optional) – Save checksum result(s) to file, by default False

Added in version 4.1.0

Changed in version 4.1.1: Checksum for entire folder is possible

checksum(recursive: bool = True) str[source]

Perform checksum

Parameters:

recursive (bool, optional) – Do checksum for every file in the folder (including child folder), by default True

Returns:

Checksum hash

Return type:

str

class absfuyu.tools.checksum.ChecksumMode(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: StrEnum

MD5 = 'md5'
SHA1 = 'sha1'
SHA256 = 'sha256'
SHA512 = 'sha512'