Metadata-Version: 2.1
Name: pycksum
Version: 0.4.5
Summary: Python implementation of cksum algorithm
Home-page: https://github.com/sobotklp/pycksum
Author: Lewis Sobotkiewicz
Author-email: lewis.sobot@gmail.com
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Description-Content-Type: text/x-rst
License-File: LICENSE

pycksum - A Python implementation of the cksum algorithm

|Build|  |PyVersion|  |PyPiVersion|  |License|

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()


.. |PyPiVersion| image:: https://img.shields.io/pypi/v/pycksum.svg
   :alt: PyPi
   :target: https://pypi.python.org/pypi/pycksum

.. |License| image:: https://img.shields.io/badge/license-MIT-yellow.svg
   :alt:

.. |PyVersion| image:: https://img.shields.io/badge/python-2.7+-blue.svg
   :alt:

.. |Build| image:: https://github.com/sobotklp/pycksum/workflows/CI/badge.svg?branch=master
     :target: https://github.com/sobotklp/pycksum/actions?workflow=CI
     :alt: CI Status
