Skip to main content

Simple hashing script for files.

Project description

file-hash

file-hash

file-hash is a simple command line hashing utility written in Python.

Requirements

  • Python 3.7+
  • Jinja2 2.10+

You should able to use this with Python < 3.7 if you have dataclass back port.

Usage

Create a hash

file_hash hash file.txt

Validate a hash

file_hash validate file.txt

Options

usage: file_hash [-h] [-a <algorithm>] [-d] [-r] [-s] [-p <path>]
              [-P [<prefix> [<prefix> ...]]] [-S [<suffix> [<suffix> ...]]]
              [-R <regex>] [-K <size>] [-J <size>]
              <command> <path>

Simple hashing script for files.

positional arguments:
  <command>             hash or validate
  <path>                Starting path

optional arguments:
  -h, --help            show this help message and exit
  -a <algorithm>, --algorithm <algorithm>
                        Algorithm to calculate hash. (Default: md5)
  -d, --dry-run         Enable dry run to check what file will be generated.
  -r, --recursive       Go through directories recursively. Use carefully with -s
  -s, --symlink         Follow symlink. Use carefully with -r
  -p <path>, --report <path>
                        Generate a HTML report.
  -P [<prefix> [<prefix> ...]], --ignore-prefix [<prefix> [<prefix> ...]]
                        Ignore files and directories that start with those prefix. (Default: ["."])
  -S [<suffix> [<suffix> ...]], --ignore-suffix [<suffix> [<suffix> ...]]
                        Ignore files and directories that end with those suffix. (Default: all hashing algorithm)
  -R <regex>, --regex <regex>
                        Only hash the files that match the regular expression. (Default: None)
  -K <size>, --min-size <size>
                        Minimum file size to be hashed. Default unit is Byte.
                        Support KB, GB, TB, PB. e.g. 1KB (Default: None)
  -J <size>, --max-size <size>
                        Maximum file size to be hashed. Default unit is Byte.
                        Support KB, GB, TB, PB. e.g. 1KB (Default: None)

Note than algorithm and dry-run does not work on validate.

Project details


Release history Release notifications

This version
History Node

1.0.1

Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
file_hash-1.0.1-py3-none-any.whl (9.0 kB) Copy SHA256 hash SHA256 Wheel py3
file_hash-1.0.1.tar.gz (6.8 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page