Skip to main content

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.

Release files for file-hash 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for file-hash 1.0.1
File Size Uploaded
file_hash-1.0.1.tar.gz 6.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for file-hash 1.0.1
File Interpreter ABI Platform
file_hash-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size:15.7 kB

Release files / file_hash-1.0.1.tar.gz

Download URL file_hash-1.0.1.tar.gz
Size 6.8 kB
Tags Source
SHA-256 checksum
How to use checksums
224abf757e6f07786a8c0644669588344c47efa7353182353634e2c0156a8c5f
BLAKE2b-256 checksum
How to use checksums
c498a09132ff452c475512743f507fe279eaaf77defbe9c2289e14ba4ce7f6ad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.7.0

Release files / file_hash-1.0.1-py3-none-any.whl

Download URL file_hash-1.0.1-py3-none-any.whl
Size 9.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
01d52e617ecc75351682d847c72bc3fdd026b5206850a11263777a12440afd90
BLAKE2b-256 checksum
How to use checksums
d2f1ce05378e413ac442ff22afe6a6fedd7f627ef2a06a778474545117254e53
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.7.0

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page