]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - common/crc.c
FIX: this commit solves a sneaky bug in 'LF VIKING' commands. The getVikingBits...
[proxmark3-svn] / common / crc.c
index 21019da9c0b97891d8717779e0bf7d5538924f7b..6c2f699430e0e6ed78d774315ce423f473bf10c7 100644 (file)
@@ -7,7 +7,6 @@
 //-----------------------------------------------------------------------------
 #include "crc.h"
 #include "util.h"
-#include <stdio.h>
 #include <stdint.h>
 #include <stddef.h>
 
@@ -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;
-}
+
Impressum, Datenschutz