mirror of
https://github.com/Proxmark/proxmark3.git
synced 2025-08-14 10:36:58 -07:00
Initial commit for the firmware. Used the 20090306_ela version as baseline.
It is identical to the popular 20081211, with the doob addition (20090301), a linux client, and two additional commands for LF analysis. Let me know if you find issues here!
This commit is contained in:
parent
b811cc51f9
commit
6658905f18
91 changed files with 16661 additions and 0 deletions
35
common/iso14443_crc.c
Normal file
35
common/iso14443_crc.c
Normal file
|
@ -0,0 +1,35 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Routines to compute the CRCs (two different flavours, just for confusion)
|
||||
// required for ISO 14443, swiped directly from the spec.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#define CRC_14443_A 0x6363 /* ITU-V.41 */
|
||||
#define CRC_14443_B 0xFFFF /* ISO/IEC 13239 (formerly ISO/IEC 3309) */
|
||||
|
||||
static unsigned short UpdateCrc14443(unsigned char ch, unsigned short *lpwCrc)
|
||||
{
|
||||
ch = (ch ^ (unsigned char) ((*lpwCrc) & 0x00FF));
|
||||
ch = (ch ^ (ch << 4));
|
||||
*lpwCrc = (*lpwCrc >> 8) ^ ((unsigned short) ch << 8) ^
|
||||
((unsigned short) ch << 3) ^ ((unsigned short) ch >> 4);
|
||||
return (*lpwCrc);
|
||||
}
|
||||
|
||||
static void ComputeCrc14443(int CrcType, BYTE *Data, int Length,
|
||||
BYTE *TransmitFirst, BYTE *TransmitSecond)
|
||||
{
|
||||
unsigned char chBlock;
|
||||
unsigned short wCrc=CrcType;
|
||||
|
||||
do {
|
||||
chBlock = *Data++;
|
||||
UpdateCrc14443(chBlock, &wCrc);
|
||||
} while (--Length);
|
||||
|
||||
if (CrcType == CRC_14443_B)
|
||||
wCrc = ~wCrc; /* ISO/IEC 13239 (formerly ISO/IEC 3309) */
|
||||
|
||||
*TransmitFirst = (BYTE) (wCrc & 0xFF);
|
||||
*TransmitSecond = (BYTE) ((wCrc >> 8) & 0xFF);
|
||||
return;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue