8000 GitHub - zjtomy/crc: pure python crc implementations
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

zjtomy/crc

 
 

Repository files navigation

Status

https://travis-ci.org/Nicoretti/crc https://ci.appveyor.com/project/Nicoretti/crc https://coveralls.io/github/Nicoretti/crc?branch=master https://landscape.io/github/Nicoretti/crc/master http://py-crc.readthedocs.org/en/latest/?badge=latest

Overview

The crc package provides provides support for the most common functionality to handle and calculate various kinds of crc checksums. (e.g. Crc8, Crc16, Crc32)

Supported CRC Algorithms:

TBD

Requirements

  • Python 3.6 and newer

Usage

Calculate and verify crc checksum using provided crc algorithm

data = [0, 1, 2, 3, 4, 5 ]
expected_checksum = 0xff
crc_calculator = CrcCalculator(Crc8.CCITT)

checksum = crc_calculator.calculate_checksum(data)

assert checksum == expected_checksum
assert crc_calculator.verfify_checksum(data, expected_checksum)

Calculate crc using the CrcRegister class

data = [0, 1, 2, 3, 4, 5 ]
expected_checksum = 0xff
crc_calculator = CrcCalculator(Crc8.CCITT)

Speed up calculation (TableBasedRegister)

data = [0, 1, 2, 3, 4, 5 ]
expected_checksum = 0xff
crc_calculator = CrcCalculator(Crc8.CCITT)

How to create a custom crc configuration

data = [0, 1, 2, 3, 4, 5 ]
expected_checksum = 0xff
crc_calculator = CrcCalculator(Crc8.CCITT)

Write your own CrcRegister based on CrcRegisterBase

Based on CrcRegisterBase

data = [0, 1, 2, 3, 4, 5 ]
expected_checksum = 0xff
crc_calculator = CrcCalculator(Crc8.CCITT)

.. code-block::

Based on AbstractCrcRegister

data = [0, 1, 2, 3, 4, 5 ]
expected_checksum = 0xff
crc_calculator = CrcCalculator(Crc8.CCITT)

Command line tools

cli extension point

name: crc.cli.command description: TBD

crc

A set of crc checksum related command line tools.

    usage:
        crc [--version][--help] <command> [<args>...]

    options:

        -h, --help      prints this help dialoge
        --version       version

    commands:
        table       creates a crc lookup table.
        verfiy      verfies a already calcualted crc for the specified data.
        calcualte   calculates the crc checksum for the specified data.

table

Command line tool to create crc lookup tables.

    usage:
        crc table [options] <width> <polynom>

    arguments:
        <polynom>       hex value of the polynom used for calculating the crc table.

    options:
        -h, --help
        --version

Tips & Tricks

Info: Main code -> crc.py works without any dependencies -> copy and paste into project but gererally highly recommend -> install using pip -> tests etc

References & Resources

About

pure python crc implementations

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%
0