Skip to main content

A command line tool to calculate hash of directory trees using various hash algorithms.

Project description

hashdir

A command line tool to calculate hash of directory trees using various hash algorithms.

installation

To install run the following command in your terminal:

pip3 install hashdir

usage

usage: hashdir [-h] [-a {md5,sha1,imohash}] [--log-level {error,info,debug}]
               [directory]

hashdir

positional arguments:
  directory

optional arguments:
  -h, --help            show this help message and exit
  -a {md5,sha1,imohash}, --algorithm {md5,sha1,imohash}
                        warning: imohash is a constant-time hashing library,
                        and while being fast for large files, it produces
                        approximate results.
  --log-level {error,info,debug}

algorithm

Hashdir performs the following steps;

  • Walk the directory tree and find all file paths.
  • Sort file paths to get a consistent hash for every system.
  • Compute the hash value for each file separately using the algorithm selected by the -a option (Or md5 as default).
  • Create a "hash string" using the results. Hash string is a string value which consists of a file path and its hash separated by a space character on each line. Print the hash string.
  • Compute the md5 hash value of the hash string and return as the result.

contributing

Contributions are welcome! Please use black for formatting code before sending a PR.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hashdir-0.17.tar.gz (3.4 kB view hashes)

Uploaded Source

Built Distribution

hashdir-0.17-py3-none-any.whl (5.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page