Skip to main content

Generate and validate checksums for files

Project description

File Checksum

Tests Status pre-commit.ci status Coverage PyPI version PyPI - Python Version

Generate checksums for files.

CVM requires that submitted data files include a checksum to verify the file has not changed. This program will generate those checksums for either a single file, or all the files in a directory.

Installation

Installation with pipx is recommended.

pipx install file-checksum

Alternatively the program can be installed with pip.

pip install file-checksum

Usage

Generate

  • Arguments
    • checksum_path: Path to the directory or file for which to generate checksums [required]
  • Options
    • --output-file, -o: Path to the file to same the checksums. Must be a .txt file. If no path is provided the output will be printed to the screen and not saved. [default: None]
    • --checksum-type, -c: The type of checksum to generate. Supported types are md5, sha1, and sha256. [default: sha256]
    • --verbose: Provides more output while running

Example

If we have the files my_file_1.xml and my_file_2.xml in the home/my_files directory, checksums can be generated for the files by running:

checksum /home/my_files -o /home/checksums.txt

The will create a file called checksums.txt in the /home directory containing the following information (hashes made up for example purposes)

sha256 checksum: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 - my_file_1.xml
sha256 checksum: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 - my_file_2.xml

Subsequent runs pointing to the same output file will append the results to the file so checksums from different directores can be save to the same file.

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

file_checksum-1.0.0.tar.gz (4.5 kB view hashes)

Uploaded Source

Built Distribution

file_checksum-1.0.0-py3-none-any.whl (5.2 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