X-Git-Url: http://cvs.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/ee4e2816753bbc28ca10c20cbfbbc7eff404cab9..ed69e099a15b4cf73610ba8646c8a06fa5431f43:/common/crc.c diff --git a/common/crc.c b/common/crc.c index 21019da9..6c2f6994 100644 --- a/common/crc.c +++ b/common/crc.c @@ -7,7 +7,6 @@ //----------------------------------------------------------------------------- #include "crc.h" #include "util.h" -#include #include #include @@ -44,8 +43,7 @@ uint32_t crc_finish(crc_t *crc) } //credits to iceman -uint32_t CRC8Maxim(uint8_t *buff, size_t size) -{ +uint32_t CRC8Maxim(uint8_t *buff, size_t size) { crc_t crc; crc_init(&crc, 9, 0x8c, 0x00, 0x00); crc_clear(&crc); @@ -56,6 +54,7 @@ uint32_t CRC8Maxim(uint8_t *buff, size_t size) return crc_finish(&crc); } +//credits to iceman uint32_t CRC8Legic(uint8_t *buff, size_t size) { // Poly 0x63, reversed poly 0xC6, Init 0x55, Final 0x00 @@ -68,10 +67,4 @@ uint32_t CRC8Legic(uint8_t *buff, size_t size) { return SwapBits(crc_finish(&crc), 8); } -uint32_t SwapBits(uint32_t value, int nrbits) { - uint32_t newvalue = 0; - for(int i = 0; i < nrbits; i++) { - newvalue ^= ((value >> i) & 1) << (nrbits - 1 - i); - } - return newvalue; -} +