Giter Club home page Giter Club logo

libcrc's Introduction

Build Status

Libcrc - Multi platform MIT licensed CRC library in C

Libcrc is a multi platform CRC library which has been under development since 1999. The original version of the source code has been available on www.lammertbies.nl since that time. Recently that code was merged with previously unpublished developments and that library is now available at Github. An online version of the CRC calculation routines is also available at www.lammertbies.nl.

The CRC library with API reference also has a new home at www.libcrc.org. An online version of the API documentation is available on this website.

License

The original version of the source code available on www.lammertbies.nl had no license attached. The repackaged version on Github is licensed with the MIT license to make the library useful in open and closed source products independent of their licensing scheme.

Differences between versions

It is safe to say that in general you should use the latest stable version of the library available from the releases page. In some circumstances it may be necessary to use an older version or to use the development version instead. The differences between these versions can be found in the Changelog document which is part of the distribution.

Please note that the development version is a snapshot of the ongoing development of the library and that that version may not be stable and reliable enough for production environments.

Platforms

Since the first version, the source code has been compiled and used on many platforms ranging from 8 bit micro controllers to 64 bit multi core servers. Most platform dependent issues should therefore have been ironed out. Currently the code is developed and maintained mainly in 32 bit and 64 bit environments. New versions of the code are regularly compiled and checked on the systems mentioned in the following lists.

32 bit development environments

Operating System Compiler
Centos 6.8 gcc 4.4.7
Debian 8.6 gcc 4.9.2
FreeBSD 10.3 clang 3.4.1
Raspbian gcc 4.8
Windows 7 Visual Studio 2015

64 bit development environments

Operating system Compiler
Centos 6.8 gcc 4.4.7
Centos 7.2.1511 gcc 4.8.5
Debian 8.6 gcc 4.9.2
FreeBSD 10.3 clang 3.4.1
OS X El Capitan 10.11.6 Apple LLVM 8.0.0
Windows 7 Visual Studio 2015

libcrc's People

Contributors

garverp avatar goutnet avatar lammertb avatar linagkar avatar property404 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

libcrc's Issues

crc16 modbus

I am using MPLAB X IDE with device dspic33fj32mc304 which has inbuilt crc generator but it not gives me appropriate results for poly=0X8005; i tried all the documents provided by microchip but i don't get what i want.
in the code of crc16 modbus which i want from your site is want lookup table but there is nothing in c file or inc file.
please help me with this small issue. i uses XC16 compiler in MPLAB.
for data 01 04 00 04 00 02 crc16 modbus is 0A 30 is not achive

Embedded processors with small memory footprint

I made some modifications for an embedded project where the memory footprint is critical but the calculation time of the crc is not. I modified the calculation function so that no lookup table is used or the lookup table is read from flash memory but this is very platform specific. Is there any interest to merge that into this project?

How to properly work with crc16 function

Hello,

I have a string of hex numbers (in Hex representation; like "AB12F1") for which I would like to calculate (and check) the CRC sum with crc16 (the hex-string is read from a transmitted file). However, I'm unsure how to use it properly. Should I feed the function with the entire hex-string, as raw string? In the sense of, interpreting every single character of the string as byte. Or should I rather convert every hex-representation (2 hex digits) into bytes?
I tested both without any success.

I'm also unsure where I have to put the checksum - I actually tested to place it in the back of the string (as usual), but this doesn't work (results in a new CRC value, which isn't 0). Furthermore, I also tried to convert the checksum first to an ASCII representation, but this also doesn't work.

Thank you!

Does not build with gcc-7

Hi,

when using gcc-7, the lib fail to build:

$ CC=gcc-7 LINK=gcc-7 make
gcc-7 -c -Wall -Wextra -Wstrict-prototypes -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wredundant-decls -Wnested-externs -Werror -O3 -funsigned-char -Iinclude/ -oobj/crc8.o src/crc8.c
gcc-7 -c -Wall -Wextra -Wstrict-prototypes -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wredundant-decls -Wnested-externs -Werror -O3 -funsigned-char -Iinclude/ -oobj/crc16.o src/crc16.c
gcc-7 -c -Wall -Wextra -Wstrict-prototypes -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wredundant-decls -Wnested-externs -Werror -O3 -funsigned-char -Iinclude/ -oobj/crc32.o src/crc32.c
gcc-7 -c -Wall -Wextra -Wstrict-prototypes -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wredundant-decls -Wnested-externs -Werror -O3 -funsigned-char -Iinclude/ -oobj/crcccitt.o src/crcccitt.c
gcc-7 -c -Wall -Wextra -Wstrict-prototypes -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wredundant-decls -Wnested-externs -Werror -O3 -funsigned-char -Iinclude/ -oobj/crcdnp.o src/crcdnp.c
gcc-7 -c -Wall -Wextra -Wstrict-prototypes -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wredundant-decls -Wnested-externs -Werror -O3 -funsigned-char -Iinclude/ -oobj/crckrmit.o src/crckrmit.c
gcc-7 -c -Wall -Wextra -Wstrict-prototypes -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wredundant-decls -Wnested-externs -Werror -O3 -funsigned-char -Iinclude/ -oobj/crcsick.o src/crcsick.c
gcc-7 -c -Wall -Wextra -Wstrict-prototypes -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wredundant-decls -Wnested-externs -Werror -O3 -funsigned-char -Iinclude/ -oobj/nmea-chk.o src/nmea-chk.c
src/nmea-chk.c: In function ‘checksum_NMEA’:
src/nmea-chk.c:72:33: error: ‘%02X’ directive output may be truncated writing between 2 and 8 bytes into a region of size 3 [-Werror=format-truncation=]
  snprintf( (char *) result, 3, "%02X", checksum );
                                 ^~~~
src/nmea-chk.c:72:32: note: directive argument in the range [0, 2147483647]
  snprintf( (char *) result, 3, "%02X", checksum );
                                ^~~~~~
In file included from /usr/include/stdio.h:936:0,
                 from src/nmea-chk.c:34:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:64:10: note: ‘__builtin___snprintf_chk’ output between 3 and 9 bytes into a destination of size 3
   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        __bos (__s), __fmt, __va_arg_pack ());
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
Makefile:117: recipe for target 'obj/nmea-chk.o' failed
make: *** [obj/nmea-chk.o] Error 1

Does not build on Ubuntu 18.04 64-bit

I pulled down the zip file today and tried to build on Ubuntu 18.04 64-bit with all updates applied.
libcrc-build-error

I assume this is because the compiler standards are a wee bit tighter now.

Use crc_ccitt_ffff for calculate from hexa data

Hello.
How i can use crc_ccitt_ffff(,) for calculation crc from hexa data? My data for crc is 890249780003A0015370C70119004FFB700039FC9FFFF4FE1EFFFFFFDDFFED00000526402A5A193DF87D50.
I need crc value 0xA9B6, but i have 0x1E66 (data calculated as ASCII). How i can fix it?

Update CRC-6 Sick documentation

Could you add the information that CRC-16 Sick only checks the most significant byte to the git documentation and also to your site? I was under the impression for a few days that it was a real CRC because this information is missing.

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.