X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/bd20f8f47847787e1f3e933043933272908c5beb..4888b2819574627efea9bd7d23444d785c5a2077:/common/iso14443crc.c diff --git a/common/iso14443crc.c b/common/iso14443crc.c index b5ffc92d..a6def1a9 100644 --- a/common/iso14443crc.c +++ b/common/iso14443crc.c @@ -18,7 +18,7 @@ static unsigned short UpdateCrc14443(unsigned char ch, unsigned short *lpwCrc) } void ComputeCrc14443(int CrcType, - unsigned char *Data, int Length, + const unsigned char *Data, int Length, unsigned char *TransmitFirst, unsigned char *TransmitSecond) { @@ -37,3 +37,12 @@ void ComputeCrc14443(int CrcType, *TransmitSecond = (unsigned char) ((wCrc >> 8) & 0xFF); return; } + +int CheckCrc14443(int CrcType, const unsigned char *Data, int Length) { + unsigned char b1; + unsigned char b2; + if (Length < 3) return 0; + ComputeCrc14443(CrcType, Data, Length - 2, &b1, &b2); + if ((b1 == Data[Length - 2]) && (b2 == Data[Length - 1])) return 1; + return 0; +}