# File Checksum
[![Tests Status](https://github.com/pbs-data-solutions/file-checksum/workflows/Testing/badge.svg?branch=main&event=push)](https://github.com/pbs-data-solutions/file-checksum/actions?query=workflow%3ATesting+branch%3Amain+event%3Apush)
[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/pbs-data-solutions/file-checksum/main.svg)](https://results.pre-commit.ci/latest/github/pbs-data-solutions/file-checksum/main)
[![Coverage](https://codecov.io/github/pbs-data-solutions/file-checksum/coverage.svg?branch=main)](https://codecov.io/gh/pbs-data-solutions/file-checksum)
[![PyPI version](https://badge.fury.io/py/file-checksum.svg)](https://badge.fury.io/py/file-checksum)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/file-checksum?color=5cc141)](https://github.com/pbs-data-solutions/file-checksum)
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](https://github.com/pypa/pipx) is recommended.
```sh
pipx install file-checksum
```
Alternatively the program can be installed with pip.
```sh
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:
```sh
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)
```console
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.
Raw data
{
"_id": null,
"home_page": "https://github.com/pbs-data-solutions/file-checksum",
"name": "file-checksum",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8,<4.0",
"maintainer_email": "",
"keywords": "python,checksum,hash",
"author": "Paul Sanders",
"author_email": "paul@pbsdatasolutions.com",
"download_url": "https://files.pythonhosted.org/packages/64/cf/ec381f006733cb3b9313584dfee04c2fafad3da1390f9832bfc06feb9c83/file_checksum-1.0.0.tar.gz",
"platform": null,
"description": "# File Checksum\n\n[![Tests Status](https://github.com/pbs-data-solutions/file-checksum/workflows/Testing/badge.svg?branch=main&event=push)](https://github.com/pbs-data-solutions/file-checksum/actions?query=workflow%3ATesting+branch%3Amain+event%3Apush)\n[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/pbs-data-solutions/file-checksum/main.svg)](https://results.pre-commit.ci/latest/github/pbs-data-solutions/file-checksum/main)\n[![Coverage](https://codecov.io/github/pbs-data-solutions/file-checksum/coverage.svg?branch=main)](https://codecov.io/gh/pbs-data-solutions/file-checksum)\n[![PyPI version](https://badge.fury.io/py/file-checksum.svg)](https://badge.fury.io/py/file-checksum)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/file-checksum?color=5cc141)](https://github.com/pbs-data-solutions/file-checksum)\n\nGenerate checksums for files.\n\nCVM requires that submitted data files include a checksum to verify the file has not changed. This\nprogram will generate those checksums for either a single file, or all the files in a directory.\n\n## Installation\n\nInstallation with [pipx](https://github.com/pypa/pipx) is recommended.\n\n```sh\npipx install file-checksum\n```\n\nAlternatively the program can be installed with pip.\n\n```sh\npip install file-checksum\n```\n\n## Usage\n\n### Generate\n\n* Arguments\n * checksum_path: Path to the directory or file for which to generate checksums [required]\n* Options\n * --output-file, -o: Path to the file to same the checksums. Must be a .txt file. If no path is\n provided the output will be printed to the screen and not saved. [default: None]\n * --checksum-type, -c: The type of checksum to generate. Supported types are md5, sha1, and sha256. [default: sha256]\n * --verbose: Provides more output while running\n\n#### Example\n\nIf we have the files `my_file_1.xml` and `my_file_2.xml` in the `home/my_files` directory, checksums\ncan be generated for the files by running:\n\n```sh\nchecksum /home/my_files -o /home/checksums.txt\n```\n\nThe will create a file called `checksums.txt` in the `/home` directory containing the following\ninformation (hashes made up for example purposes)\n\n```console\nsha256 checksum: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 - my_file_1.xml\nsha256 checksum: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 - my_file_2.xml\n```\n\nSubsequent runs pointing to the same output file will append the results to the file so checksums\nfrom different directores can be save to the same file.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Generate and validate checksums for files",
"version": "1.0.0",
"split_keywords": [
"python",
"checksum",
"hash"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "58b3dae3cf4961941737462fff4b49afdbbbbe2c383966645df69493d9ec54f2",
"md5": "bc1f85e7256c4786a216a75fd703083a",
"sha256": "ebc753e20737b58ac554fbd93f6ecf80f94259b91f7a2c334e083e187fb3e0fc"
},
"downloads": -1,
"filename": "file_checksum-1.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "bc1f85e7256c4786a216a75fd703083a",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8,<4.0",
"size": 5179,
"upload_time": "2023-04-13T14:37:20",
"upload_time_iso_8601": "2023-04-13T14:37:20.562920Z",
"url": "https://files.pythonhosted.org/packages/58/b3/dae3cf4961941737462fff4b49afdbbbbe2c383966645df69493d9ec54f2/file_checksum-1.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "64cfec381f006733cb3b9313584dfee04c2fafad3da1390f9832bfc06feb9c83",
"md5": "09f2a2fafe63dea2cd8d73b6b59d97f7",
"sha256": "5fd3c61a1c01b59d3b94040f7a8b39d71d1fcf93348d12d4037615b4dd7907c6"
},
"downloads": -1,
"filename": "file_checksum-1.0.0.tar.gz",
"has_sig": false,
"md5_digest": "09f2a2fafe63dea2cd8d73b6b59d97f7",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8,<4.0",
"size": 4465,
"upload_time": "2023-04-13T14:37:23",
"upload_time_iso_8601": "2023-04-13T14:37:23.849823Z",
"url": "https://files.pythonhosted.org/packages/64/cf/ec381f006733cb3b9313584dfee04c2fafad3da1390f9832bfc06feb9c83/file_checksum-1.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-04-13 14:37:23",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "pbs-data-solutions",
"github_project": "file-checksum",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "file-checksum"
}