Skip to main content

hashsum

Python drop-in replacement for md5sum, and co.

HomePage:

https://github.com/avalentino/hashsum

Copyright:

2016-2021 Antonio Valentino <antonio dot valentino at tiscali dot it>

Latest Version Supported Python versions License GHA status page Coverage Status

Usage

usage: hashsum [-h] [-a] [--tag] [-b | -t] [-c | -l] [--quiet]
               [--status] [--strict] [-w] [-m] [--version]
               [FILE [FILE ...]]

Compute and check message digest with different hash algorithms.
The sums are computed as described in [1].
When checking, the input should be a former output of this program.
The default mode is to print a line with checksum, a character
indicating input mode ('*' for binary, space for text), and name
for each FILE.

[1] https://docs.python.org/3/library/hashlib.html

positional arguments:
  FILE                  name of file to process. If not specified,
                        or set to -, data are read form the
                        standard input

optional arguments:
  -h, --help            show this help message and exit
  -a , --algorithm      specify the hashing algorithm
                        (default: 'md5')
  --tag                 create a BSD-style checksum
  -b, --binary          read input data in binary mode
  -t, --text            read input data in text mode (default)
  -c, --check           read checksum(s) form FILE and check them
  -l, --list-algorithms
                        list available hashing algorithms
  -m, --multi-thread    perform I/O and hash computation in separate threads
                        (default=False). Can speed-up computation on large
                        files while it is not recommended for small files.
  --version             show program's version number and exit

check:
  Options that are useful only when verifying checksums

  --quiet               don't print OK for each successfully
                        verified file
  --status              don't output anything, status code shows
                        success
  --strict              exit non-zero for improperly formatted
                        checksum lines
  -w, --warn            warn about improperly formatted checksum
                        lines

Package testing

The recommended way to test the package is to use pytest:

$ python3 -m pytest -v

========================== test session starts ==========================
platform linux -- Python 3.9.5, pytest-6.0.2, py-1.10.0, pluggy-0.13.0
hashsum version:      1.4.0.dev0
Platform:             Linux-5.11.0-24-generic-x86_64-with-glibc2.33
Byte-ordering:        little
Default encoding:     utf-8
Default FS encoding:  utf-8
Default locale:       ('it_IT', 'UTF-8')
rootdir: /home/antonio/projects/hashsum, configfile: setup.cfg
plugins: hypothesis-5.43.3, remotedata-0.3.2, doctestplus-0.9.0,
        openfiles-0.5.0, flake8-1.0.6, filter-subpackage-0.1.1, cov-2.10.1
collected 26 items

tests/test_hashsum.py::ComputeSumTestCase::test_binary PASSED       [  3%]
tests/test_hashsum.py::ComputeSumTestCase::test_binary_auto PASSED  [  7%]

[...]

tests/test_hashsum.py::ThreadedCheckTestCase::test_text PASSED      [100%]

========================== 26 passed in 0.29s ===========================

Please note that some basic system information that can be sued for bug reporting are also printed on the screen.

The default configuration for “pytest” is stored into the setup.cfg file in the root directory of the source package:

[tool:pytest]
addopts = -p no:warnings -p no:logging

Alternatively it is possible to use:

$ python3 -m unittest -v tests/test_hashsum.py

License

The hashsum software is distribute under the terms of the “3-Clause BSD License” see LICENSE.txt file for details.

hashsum changelog

hashsum v1.4.1 (18/07/2021)

  • Fix the wheel generation: generated wheel are not universal, they only work with Python 3.6 and higher

hashsum v1.4.0 (18/07/2021)

  • Drop support for Python < 3.6.

  • Switch to GitHub Actions for CI.

  • Fix verification of checksums in text mode on Windows.

  • Re-factorize and simplify the test code.

  • Add buildsystem support (pyproject.toml)

  • Switch to declarative setup configuration (setup.cfg).

hashsum v1.3.0 (25/08/2019)

  • hashsum.VERSION renamed into hashsum.__version__

  • added test utility functions

  • prefer lowercase names for hash functions

  • improve robustness against unknown/unavailable hash functions in threaded checksum computation

  • new –failfast option added to the test CLI

  • improved benchmark script

  • man page updated

  • improved compatibility with pytest

hashsum v1.2.2 (15/11/2016)

  • Fix compatibility with the windows operating system

hashsum v1.2.1 (24/08/2016)

  • Minor packaging fixes

hashsum v1.2.0 (24/08/2016)

  • Improved compatibility with the OpenSSL command line tool

  • Better iteration on data blocks

  • Optional threaded hash computation

  • Refactoring: the entire code has been re-organized in tools

  • Drop all gettext related files

hashsum v1.1.1 (30/01/2016)

  • Include man pages in the tarball

hashsum v1.1 (30/01/2016)

  • Fixed IncrementalNewlineDecoder.decoder signature

  • Always call decode with final=True when reading in text mode

  • Factorized code for checksum computation

  • All Exceptions are now trapped in the main function

  • Added unit testing

  • Code cleanup

  • Added NEWS.rst file

  • Added man page

  • Improved command line help (also fixed some typos)

  • Enabled automatic testing with travis-ci

hashsum v1.0 (04/01/2016)

  • Initial release

Metadata

Release files for hashsum 1.4.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 hashsum 1.4.1
File Size Uploaded Provenance Actions
hashsum-1.4.1.tar.gz 15.4 kB Without provenance Details for hashsum-1.4.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for hashsum 1.4.1
File Interpreter ABI Platform Actions
hashsum-1.4.1-py3-none-any.whl Python 3 none any Details for hashsum-1.4.1-py3-none-any.whl

Total release size: 25.9 kB

Release files / hashsum-1.4.1.tar.gz

Download URL hashsum-1.4.1.tar.gz
Size 15.4 kB
Tags Source
SHA-256 checksum
How to use checksums
2c40505ab82578651f9875241c48d03a1149c36eabd858907b7f3ab047a8c5e7
BLAKE2b-256 checksum
How to use checksums
b52e755f43f8bac40b31976252ad86bf44118819822cab61de85b39e8e19bd45
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.4.2 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.9.5

Release files / hashsum-1.4.1-py3-none-any.whl

Download URL hashsum-1.4.1-py3-none-any.whl
Size 10.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0092627a2ce2c444d8493ed11d24962b751e6b8c488ae231d7407a34305f94c3
BLAKE2b-256 checksum
How to use checksums
c1b28969b68a3d22ffa4408d3f88070c7d0bed050ebb5cc9da2c2af8770c8087
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.4.2 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.9.5

Security for hashsum 1.4.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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