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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pycksum-0.5.0.tar.gz.
File metadata
- Download URL: pycksum-0.5.0.tar.gz
- Upload date:
- Size: 63.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c6ea69e83dbc14900fb5a53f0e696feca2966ca933a9af46ce74893a441d8d77
|
|
| MD5 |
9bed0e46431a5fc9970c0508b66fc64e
|
|
| BLAKE2b-256 |
0dd4c6420bd10af84cdcc509973f346344058856393a1c55741ecc3003723f87
|
File details
Details for the file pycksum-0.5.0-cp39-cp39-macosx_10_9_universal2.whl.
File metadata
- Download URL: pycksum-0.5.0-cp39-cp39-macosx_10_9_universal2.whl
- Upload date:
- Size: 40.4 kB
- Tags: CPython 3.9, macOS 10.9+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
02f73e9fd50c3c207ac358f33c03d01ac4e2fa1967218c9fb155762ffcd7b33e
|
|
| MD5 |
02e1f9067bffad0cc2e071babe85789c
|
|
| BLAKE2b-256 |
b13a05528ff52411abdb6027b2792e3607b68aafe45e594b603d49c8b922410f
|