Auto Docs¶
dirhash: Produce a checksum, similar to a hash, for directories.
-
dirhash.hash_dir(path, chunksize=1000000, algo='md5', resolve_symlinks=True)¶ Produce the hexdigest of the ‘hash’ of a directory recursively.
Directory ‘hashes’, much like file hashes, when compared, can confirm that each contains an identical series of bytes. In the case of the directory ‘hash’ these bytes must be an identical set of files, but all attributes of the files except their contents is ignored.
Parameters: - path (pathlib.Path) – The path to the directory to hash
- chunksize (int) – The maximum amount of any file to read into RAM at once, in bytes
- algo (str) – The hashing algorithm to use, passed to
hashlib.new() - resolve_symlinks (bool) – Whether or not to resolve symlinks.
-
dirhash.hash_entry(path, chunksize=1000000, algo='md5', resolve_symlinks=True)¶ Produce the hash of a file or directory.
See hash_{file,dir} for more information.
Parameters: - path (pathlib.Path) – The path to the directory to hash
- chunksize (int) – The maximum amount of any file to read into RAM at once, in bytes
- algo (str) – The hashing algorithm to use, passed to
hashlib.new() - resolve_symlinks (bool) – Whether or not to resolve symlinks.
-
dirhash.hash_file(path, chunksize=1000000, algo='md5')¶ Produce the hexdigest of the hash of a file.
Parameters: - path (pathlib.Path) – The filepath to the file to be hashed
- chunksize (int) – The maximum amount of the file to read into RAM at once, in bytes.
- algo (str) – The hashing algorithm to use, passed to
hashlib.new()
Returns: A
_hashlib.HASHobject containing the hash of the fileReturn type: