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
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
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 Distributions
Hashes for pycksum-0.3.6.macosx-10.7-intel.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | aef2998181e3549c17ad856fbb08682de34d0bb28a1a7bb5aeb2e9b7fbe8fda8 |
|
MD5 | 38aa2bf78b5d511ad0af8492d8d8dee9 |
|
BLAKE2b-256 | 7798babeb36c455fd5dc520d3ef2f7d3707ae5d85f4b7f1878a653b298504b5e |
Hashes for pycksum-0.3.6.linux-x86_64.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0b907b98ee7d27c21554dcd515e081091c3178fa8b395a281cfcb03aec4d1bef |
|
MD5 | 147c08885c69bfc7cbfe5f6b8777b865 |
|
BLAKE2b-256 | 8af6a7175a0c69c3278ee99851ac4ac82b9820059f28298dc3cd8757075d2571 |