hash_directory_tree

Function hash_directory_tree 

Source
pub async fn hash_directory_tree<D: Digest>(
    dir: &Path,
    hasher: &mut D,
) -> Result<()>
Expand description

Compute a hash of a directory tree using the provided hasher.

This function traverses the directory tree deterministically (sorted by file name) and includes both file paths and file contents in the hash computation.

§Arguments

  • dir - The directory to hash
  • hasher - A hasher implementing the Digest trait (e.g., Sha256::new())

§Returns

() - The hasher is updated with the directory tree data