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
File details
Details for the file pycksum-0.4.0.tar.gz
.
File metadata
- Download URL: pycksum-0.4.0.tar.gz
- Upload date:
- Size: 15.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d0ca48aac0034e2f7be6a39f34eaddef5de031643b3c2808d9fdd91ad4d8a85c |
|
MD5 | d5e558d2d2ca0c307329a66f1c09f619 |
|
BLAKE2b-256 | 12b3abbfe156e25b67bf7b00e3f358b976028134c83013871668a9197899df39 |