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 Distribution
File details
Details for the file pycksum-0.4.1.tar.gz
.
File metadata
- Download URL: pycksum-0.4.1.tar.gz
- Upload date:
- Size: 15.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1e3df1fdfd3e7dd19abc3206e25d95fd99f37024d56b723b230ef13dd8add5b6 |
|
MD5 | ea87b2769ea1ed5bfd91261f250c8060 |
|
BLAKE2b-256 | ab728014bbcc2a6ac84c2404d771348aa2aa8eaae86d1dba1773e9284805655d |
File details
Details for the file pycksum-0.4.1-cp27-none-macosx_10_10_intel.whl
.
File metadata
- Download URL: pycksum-0.4.1-cp27-none-macosx_10_10_intel.whl
- Upload date:
- Size: 16.8 kB
- Tags: CPython 2.7, macOS 10.10+ intel
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0d992b8b7d5508df4873b0b9868bd280458c7c2539847127f9252d0fc90c89ef |
|
MD5 | 57077e00e13a41ef2b769009032ec051 |
|
BLAKE2b-256 | 2b38f27860bf49f154100f6b1dcb1fc32e3371d4dfcf00801b498101309f263e |