Skip to main content

CLI for verifying checksums with the minimum effort.

Project description

csum

License: MIT PyPI

Introduction

csum is a CLI program which allows you to to verify checksums. The goal of csum is to minimise the effort required when you download a file and want to verify the checksum.

csum supports the most common checksum algorithms:

  • MD5
  • SHA256
  • SHA512
  • SHA1

In addition, it supports SHA3_512, SHA224, BLAKE2S, SHA3_224, SHA3_256, SHA3_384, SHA384 and BLAKE2B.

Requirements

You need to have Python 3.6 or higher installed. This will allow you to install csum with Python's package manager, pip.

How to install

To install csum with pip, run the command:

pip install csum

After this command completes, the csum executable should be available on the PATH.

Quick start

csum is designed to be as simple to use as possible. For this reason, you don't need to specify the checksum type (e.g. sha256); csum will iterate through the most common types first.

Usage examples

File and checksum

You can call csum with a filename and checksum:

csum file.zip 40f66f20b1ecb05cb11a9627520aafafbc8cd86b33eb8019cbea9925d8ca83ce2

Or a checksum and filename:

csum 40f66f20b1ecb05cb11a9627520aafafbc8cd86b33eb8019cbea9925d8ca83ce2  file.zip 

Absolute or relative paths, and paths including tilde (~), are accepted:

csum ~/Downloads/file.zip 40f66f20b1ecb05cb11a9627520aafafbc8cd86b33eb8019cbea9925d8ca83ce2  

Preformatted checksum/filename

Sometimes you are provided with a checksum of the form:

40f66f20b1ecb05cb11a9627520aafafbc8cd86b33eb8019cbea9925d8ca83ce2 file.zip

Assuming that the file is in the current working directory, you can simply copy this text and paste it after the csum command:

csum 40f66f20b1ecb05cb11a9627520aafafbc8cd86b33eb8019cbea9925d8ca83ce2  file.zip

If you prefer, you can supply it as a single argument:

csum "40f66f20b1ecb05cb11a9627520aafafbc8cd86b33eb8019cbea9925d8ca83ce2  file.zip"

Tip: The number of spaces between the checksum and filename doesn't matter in either case.

Manually choosing an algorithm

If you prefer to select a certain algorithm instead of iterating through them, you can use the -a/--algorithm parameter.

For example, using the SHA256 algorithm only:

csum -a sha256 file.zip 40f66f20b1ecb05cb11a9627520aafafbc8cd86b33eb8019cbea9925d8ca83ce2

Tip: You can provide the algorithm name as either lower-case or upper-case, e.g. sha256 or SHA256.

Expected output

When you use csum, a positive response will be of the form:

        --------------------------------------------------------------------------------

        File: file.zip
        Algorithm: SHA256

        Expected checksum:    40f66f20b1ecb05cb11a9627520aafafbc8cd86b33eb8019cbea9925d8ca83ce2
        Calculated checksum:  40f66f20b1ecb05cb11a9627520aafafbc8cd86b33eb8019cbea9925d8ca83ce2

        Checksums match         --------------------------------------------------------------------------------

SUCCESS: SHA256 checksum matched file.

A negative response will be of the form:

        --------------------------------------------------------------------------------

        File: file.zip
        Expected checksum:    40f66f20b1ecb05cb11a9627520aafafbc8cd86b33eb8019cbea9925d8ca83ce2

        Checksums do NOT match.

        --------------------------------------------------------------------------------

FAILED: algorithm(s) did not match the checksum.

License

You may freely use, modify and redistribute this program under the terms of the MIT License. See LICENSE.

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

csum-1.0.0.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

csum-1.0.0-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file csum-1.0.0.tar.gz.

File metadata

  • Download URL: csum-1.0.0.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.9.1

File hashes

Hashes for csum-1.0.0.tar.gz
Algorithm Hash digest
SHA256 bf696d8ee5f6ed1f618a272a5b6638c2e23817c3a31354c7cd89f70d9f1f6649
MD5 156a4150c002150cf6a797cb9663274f
BLAKE2b-256 d90a6252be5760052c86083c7bcccdb37c16eceb96b8b53f03da95ead4eed473

See more details on using hashes here.

File details

Details for the file csum-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: csum-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.9.1

File hashes

Hashes for csum-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fce7016d162e014d0c5d7422e70f8134a3bfef47265d82aed9df783ff14d8996
MD5 9e11b360a4a31aba36aa0b6bc32f6008
BLAKE2b-256 661bcc49406bf3608d16ccb92aedbdbf99bbe5fd9e3602f332122c40014559b2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page