mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 13:53:55 -07:00
Merge pull request #1559 from bthedorff/master
Update wiegand_formats.c
This commit is contained in:
commit
0b7c529152
2 changed files with 35 additions and 0 deletions
|
@ -5,6 +5,7 @@ This project uses the changelog in accordance with [keepchangelog](http://keepac
|
|||
## [unreleased][unreleased]
|
||||
- Add `nfc decode` - now NDEF vCard messages with a PHOTO in base64 format is shown (@iceman1001)
|
||||
- Remove AID limitations when using Gallagher key diversification (@DarkMatterMatt)
|
||||
- Adds support for PCSC's proprietary HID 37bit format P10004 (@bthedorff)
|
||||
|
||||
## [Frostbit.4.14831] [2022-01-11]
|
||||
- Changed Wiegand format lookup - now case-insensitive (@iceman1001)
|
||||
|
|
|
@ -770,6 +770,39 @@ static bool Unpack_H10302(wiegand_message_t *packed, wiegand_card_t *card) {
|
|||
return true;
|
||||
}
|
||||
|
||||
static bool Pack_P10004(wiegand_card_t *card, wiegand_message_t *packed, bool preamble) {
|
||||
memset(packed, 0, sizeof(wiegand_message_t));
|
||||
|
||||
if (card->FacilityCode > 0x0000FFFF) return false; // Can't encode FC.
|
||||
if (card->CardNumber > 0x0007FFFF) return false; // Can't encode CN.
|
||||
if (card->IssueLevel > 0) return false; // Not used in this format
|
||||
if (card->OEM > 0) return false; // Not used in this format
|
||||
|
||||
packed->Length = 37; // Set number of bits
|
||||
|
||||
set_linear_field(packed, card->FacilityCode, 1, 13);
|
||||
set_linear_field(packed, card->CardNumber, 14, 18);
|
||||
|
||||
set_bit_by_position(packed, evenparity32(get_linear_field(packed, 1, 18)), 0);
|
||||
set_bit_by_position(packed, oddparity32(get_linear_field(packed, 18, 18)), 36);
|
||||
if (preamble)
|
||||
return add_HID_header(packed);
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool Unpack_P10004(wiegand_message_t *packed, wiegand_card_t *card) {
|
||||
memset(card, 0, sizeof(wiegand_card_t));
|
||||
|
||||
if (packed->Length != 37) return false; // Wrong length? Stop here.
|
||||
|
||||
card->FacilityCode = get_linear_field(packed, 1, 13);
|
||||
card->CardNumber = get_linear_field(packed, 14, 18);
|
||||
card->ParityValid =
|
||||
(get_bit_by_position(packed, 0) == evenparity32(get_linear_field(packed, 1, 18))) &&
|
||||
(get_bit_by_position(packed, 36) == oddparity32(get_linear_field(packed, 18, 18)));
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool Pack_H10304(wiegand_card_t *card, wiegand_message_t *packed, bool preamble) {
|
||||
memset(packed, 0, sizeof(wiegand_message_t));
|
||||
|
||||
|
@ -1370,6 +1403,7 @@ static const cardformat_t FormatTable[] = {
|
|||
{"H10320", Pack_H10320, Unpack_H10320, "HID H10320 36-bit BCD", {1, 0, 0, 0, 1}}, // from Proxmark forums
|
||||
{"H10302", Pack_H10302, Unpack_H10302, "HID H10302 37-bit huge ID", {1, 0, 0, 0, 1}}, // from Proxmark forums
|
||||
{"H10304", Pack_H10304, Unpack_H10304, "HID H10304 37-bit", {1, 1, 0, 0, 1}}, // from cardinfo.barkweb.com.au
|
||||
{"P10004", Pack_P10004, Unpack_P10004, "HID P10004 37-bit PCSC", {1, 1, 0, 0, 1}}, // from BT
|
||||
{"HGen37", Pack_HGeneric37, Unpack_HGeneric37, "HID Generic 37-bit", {1, 0, 0, 0, 1}}, // from cardinfo.barkweb.com.au
|
||||
{"MDI37", Pack_MDI37, Unpack_MDI37, "PointGuard MDI 37-bit", {1, 1, 0, 0, 1}}, // from cardinfo.barkweb.com.au
|
||||
{"BQT38", Pack_bqt38, Unpack_bqt38, "BQT 38-bit", {1, 1, 1, 0, 1}}, // from cardinfo.barkweb.com.au
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue