This commit is contained in:
iceman1001 2019-04-11 07:40:50 +02:00
commit 7547952a4d
4 changed files with 8 additions and 9 deletions

View file

@ -200,7 +200,7 @@ int CmdHIDDemod(const char *Cmd) {
cardnum = (lo >> 1) & 0xFFFFF; cardnum = (lo >> 1) & 0xFFFFF;
fc = ((hi & 1) << 11) | (lo >> 21); fc = ((hi & 1) << 11) | (lo >> 21);
} }
if(fmtLen==36){ if (fmtLen == 36) {
oem = (lo >> 1) & 0x3; oem = (lo >> 1) & 0x3;
cardnum = (lo >> 3) & 0xFFFF; cardnum = (lo >> 3) & 0xFFFF;
fc = (hi & 0x7) << 13 | ((lo >> 19) & 0xFFFF); fc = (hi & 0x7) << 13 | ((lo >> 19) & 0xFFFF);
@ -405,7 +405,7 @@ static void calc34(uint16_t fc, uint32_t cardno, uint8_t *out) {
// *lo = ((cardno & 0xFFFFF) << 1) | fc << 21; // *lo = ((cardno & 0xFFFFF) << 1) | fc << 21;
// *hi = (1 << 5) | ((fc >> 11) & 1); // *hi = (1 << 5) | ((fc >> 11) & 1);
// } // }
static void calc36(uint8_t oem, uint16_t fc, uint32_t cardno, uint8_t *out){ static void calc36(uint8_t oem, uint16_t fc, uint32_t cardno, uint8_t *out) {
// FC 1 - 16 - 16 bit // FC 1 - 16 - 16 bit
// cardno 17 - 33 - 16 bit // cardno 17 - 33 - 16 bit
// oem 34 - 35 - 2 bit // oem 34 - 35 - 2 bit

View file

@ -277,7 +277,7 @@ int CodeCmp(const char *code1, const char *code2) {
return -1; return -1;
} }
const APDUCode * GetAPDUCode(uint8_t sw1, uint8_t sw2) { const APDUCode *GetAPDUCode(uint8_t sw1, uint8_t sw2) {
char buf[6] = {0}; char buf[6] = {0};
int res; int res;
int mineq = APDUCodeTableLen; int mineq = APDUCodeTableLen;

View file

@ -752,12 +752,11 @@ void wiegand_add_parity(uint8_t *target, uint8_t *source, uint8_t length) {
} }
// add HID parity to binary array: ODD prefix for 1st half of ID, EVEN suffix for 2nd half // add HID parity to binary array: ODD prefix for 1st half of ID, EVEN suffix for 2nd half
void wiegand_add_parity_swapped(uint8_t *target, uint8_t *source, uint8_t length) void wiegand_add_parity_swapped(uint8_t *target, uint8_t *source, uint8_t length) {
{ *(target++) = GetParity(source, ODD, length / 2);
*(target++)= GetParity(source, ODD, length / 2);
memcpy(target, source, length); memcpy(target, source, length);
target += length; target += length;
*(target)= GetParity(source + length / 2, EVEN, length / 2); *(target) = GetParity(source + length / 2, EVEN, length / 2);
} }
// xor two arrays together for len items. The dst array contains the new xored values. // xor two arrays together for len items. The dst array contains the new xored values.