Skip to main content

Python implementation of cksum algorithm

Project description

pycksum - A Python implementation of the cksum algorithm

Build Status

The cksum algorithm generates a checksum for a stream of data. While cksum is not cryptographically strong, it can be used to validate the integrity of transferred files.

Pycksum includes a pure Python implementation of cksum as well as an efficient C extension that will automatically be used on platforms that support it.

Installation

Install from PyPi using pip, a package manager for Python:

$ pip install pycksum

Examples

The simplest way to use pycksum is to just give it a string:

import pycksum
ck = pycksum.cksum("Any string")

You can pass in a file or an iterable:

ck = pycksum.cksum( open("filename"))

ck = pycksum.cksum( ["This", "love", "is", "taking", "its", "toll", "on me"])

If you have a lot of data to process, it’s more memory-efficient to calculate the cksum incrementally:

c = pycksum.Cksum()
for data in input_fd:
    c.add(data)
ck = c.get_cksum()
sz = c.get_size()

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

pycksum-0.4.3.tar.gz (16.7 kB view details)

Uploaded Source

File details

Details for the file pycksum-0.4.3.tar.gz.

File metadata

  • Download URL: pycksum-0.4.3.tar.gz
  • Upload date:
  • Size: 16.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.40.0 CPython/3.7.5

File hashes

Hashes for pycksum-0.4.3.tar.gz
Algorithm Hash digest
SHA256 dd3cc8cfd7dbec53f09afc9c3ede23781db23cafdd58dd2a4ce63a55065c86a3
MD5 3cb22a50500046eae66f7e95fe72cfe2
BLAKE2b-256 67054eeadd376d29bfe616cf5cd05f6601fdaf8b45108a230bb0fc7aecb8c5bc

See more details on using hashes here.

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