httk.core.digests¶
Compute deterministic SHA-256 digests for files and directory trees.
Hash tree paths and entries in sorted order without following symlinks.
Functions¶
|
Return the lowercase SHA-256 digest of one regular file. |
|
Hash a tree without following symlinks. |
Module Contents¶
- httk.core.digests.sha256_file(path)[source]¶
Return the lowercase SHA-256 digest of one regular file.
- Parameters:
path (pathlib.Path) – Regular file to hash.
- Returns:
Lowercase SHA-256 digest.
- Return type:
- httk.core.digests.tree_digest(path, *, skip=None, exclude=None)[source]¶
Hash a tree without following symlinks.
skip names top-level entries to leave out of the digest entirely. exclude names relative POSIX paths to leave out; excluding a directory also leaves out its descendants.
- Parameters:
path (pathlib.Path) – Root directory to hash.
skip (collections.abc.Callable[[str], bool] | None) – Optional predicate for top-level entries to omit.
exclude (collections.abc.Callable[[str], bool] | None) – Optional predicate for relative POSIX paths to omit.
- Returns:
Lowercase SHA-256 digest.
- Raises:
ValueError – If the tree contains a symlink or special file.
- Return type: