Python implementation of cksum algorithm
Project description
pycksum - A Python implementation of the cksum algorithm
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
$ 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for pycksum-0.3.4.macosx-10.7-intel.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | e86e0bf04947d418a482ae2a692575d471419e18b7ddb601ffaeb6440db3fa11 |
|
MD5 | ffab4723201fe71685f7ab6ae03a2095 |
|
BLAKE2b-256 | 03e61f4f4037d3d75724738ef4b85042730d2473f33fdf50368c9be157bf1f8f |