Skip to main content

A module that implements the CRC8 hash algorithm for Python 2 and 3.

Project description

Python Package Version on Pypi Downloads from Pypi

A module that implements the CRC8 hash algorithm for Python 2 and 3.

Installation

pip install crc8

Or copy the crc8.py file somewhere where you can import it.

Usage

The crc8 class has the same interface as the hash functions in the hashlib module.

Example:

import crc8
hash = crc8.crc8()
hash.update(b'123')
assert hash.hexdigest() == 'c0'
assert hash.digest() == b'\xc0'
hash.reset()
assert hash.hexdigest() == '00'

You can also use the method chaining syntax:

import crc8
hash = crc8.crc8()
result = hash.reset().update(b'123').hexdigest()
assert result == 'c0'

Contribute

If something s not there that you would like to have, open an issue, create a pull request.

The license is MIT and I value contributions if you modify the code.

Changelog

  • v0.2.0 - add reset() by henriksod

  • v0.1.0 - add option to select initial polynom by FevGeb

  • v0.0.5 - document license

  • v0.0.4 - choose MIT license

Release

Install twine.

python setup.py sdist
source .env # if you have stored TWINE_USERNAME and TWINE_PASSWORD
twine upload dist/*

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

crc8-0.2.1.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

crc8-0.2.1-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file crc8-0.2.1.tar.gz.

File metadata

  • Download URL: crc8-0.2.1.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for crc8-0.2.1.tar.gz
Algorithm Hash digest
SHA256 2ea9e0a04fbb9621daf278da7cba0c11e5fc2f7af74d44d35e08832d3a7a4d23
MD5 6d873cc0982c8a0b22174d0282e9a1e4
BLAKE2b-256 914aaeba5e1ddd6f1035f634899a1fa133c9d57156d392386859e0cf84c1d62b

See more details on using hashes here.

File details

Details for the file crc8-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: crc8-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for crc8-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0c7cc1e442f4e5227a4f1b83a025454fd2d575177c7f78f35814580c7ffd073a
MD5 285b406761c60e0e8935d3a28f2178a9
BLAKE2b-256 d8f86d922e3fb4b175f105150992c62aac05bb0cfe41fb138f9afda5a27f838f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page