Git Product home page Git Product logo

crcany's Introduction

Synopsis

crcany can compute any CRC, given the parameters that describe it. Those parameters are given in the form used on Greg Cook's catalog of CRCs at http://reveng.sourceforge.net/crc-catalogue/all.htm , where that set of parameters were first defined by Ross Williams in his excellent tutorial on CRCs at http://zlib.net/crc_v3.txt .

crcany computes each CRC three different ways. First, computing a bit at a time, as you would in any self-respecting hardware implementation. Second, using the bit-at-a-time algorithm to create a table of 256 CRCs that can be used to compute that CRC a byte at a time. Third, using the byte-wise table to generate another n-1 tables, where n is the number of bytes in the largest integer, to enable computing a CRC a word at a time. The word-wise approach has two flavors, one for little-endian machines, and one for big-endian machines.

The bit-wise calculation can be done on CRCs up to twice the word length, e.g. 128 bits on machines with 64-bit integers. The byte and word-wise calculations can be done on CRCs up to the word size, e.g. up to 64-bit CRCs using 64-bit integers.

crcgen generates C code for each CRC definition read from stdin, putting the resulting code into .h and .c files for each definition in the src/ subdirectory. Test code is also generated in src/crc_test.c. Code is generated for the machine being run on (i.e. with respect to the lengths of the integer types and their endianess), and will generate code for any CRC whose width is less than or equal to the maximum integer size.

Motivation

Provide once and for all a definitive reference for how to compute any CRC with any of bit, byte, or word-at-a-time algorithms, on any big or little-endian architecture.

Installation

This will compile the crcany, crcgen, and mincrc executables:

make

Test

Test crcany and crcgen using the list of all catalogued CRCs, available here in the file allcrcs.txt, and test mincrc against the abbreviated list using the Makefile:

make test

License

This code is under the zlib license, permitting free commercial use.

crcany's People

Contributors

madler avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.