From 3e7de8a116e84605a6b44ac6852f16c512a9a05d Mon Sep 17 00:00:00 2001 From: Gabriele Gristina Date: Fri, 6 Nov 2026 23:42:11 +0100 Subject: [PATCH] wiegand: fix HPP32, H10320, S12906b, HGen37, format limits, list usage HPP32 wrote its card number 10 bits past the 32-bit frame, it now uses bits 13-30 as cardinfo shows. H10320 wrote its first digit over the leading one, so decode refused most numbers, and two of its parity masks had typos. S12906b needed ParityValid, which no caller sets. HGen37 decode checked bit 28 instead of 26. The limits of nine formats did not match the fields Pack writes. wiegand list printed the usage of wiegand info. Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 1 + client/src/cmdwiegand.c | 2 +- client/src/wiegand_formats.c | 51 ++++++++++++++++++------------------ doc/commands.json | 4 +-- tools/pm3_tests.sh | 33 +++++++++++++++++++++++ 5 files changed, 62 insertions(+), 29 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a1bedd944..0319793e3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ All notable changes to this project will be documented in this file. This project uses the changelog in accordance with [keepchangelog](http://keepachangelog.com/). Please use this to write notable changes, which is not the same as git commit log... ## [unreleased][unreleased] +- Fixed `wiegand` formats - HPP32, H10320 and S12906b encode as laid out, HGen37 decode checks the right parity bit, the limits of nine formats match their fields, `wiegand list -h` shows its own usage (@matrix) - Fixed flashing with redirected output - the progress animation is drawn only when stdout is a terminal (@matrix) - Fixed `proxmark3 --flash`, `--dumpmem` and `--reboot-to-bootloader` exit status - a failure exits 1, a failed flash no longer ends with `All done` (@matrix) - Fixed `data rawdemod` - `--max`, `--samples` and the `--p2` clock no longer wrap above 255, `--fs` refuses values above 255 (@matrix) diff --git a/client/src/cmdwiegand.c b/client/src/cmdwiegand.c index ff4a1cc93..545b5b151 100644 --- a/client/src/cmdwiegand.c +++ b/client/src/cmdwiegand.c @@ -135,7 +135,7 @@ static int wiegand_encode_new_pacs_from_bin(const uint8_t *binarr, int blen, boo int CmdWiegandList(const char *Cmd) { CLIParserContext *ctx; - CLIParserInit(&ctx, "wiegand info", + CLIParserInit(&ctx, "wiegand list", "List available wiegand formats", "wiegand list" ); diff --git a/client/src/wiegand_formats.c b/client/src/wiegand_formats.c index 0791ac876..71658cb3e 100644 --- a/client/src/wiegand_formats.c +++ b/client/src/wiegand_formats.c @@ -384,7 +384,7 @@ static bool Pack_hpp32(int format_idx, wiegand_card_t *card, wiegand_message_t * packed->Length = 32; // Set number of bits set_linear_field(packed, card->FacilityCode, 1, 12); - set_linear_field(packed, card->CardNumber, 13, 29); + set_linear_field(packed, card->CardNumber, 13, 18); if (preamble) return add_HID_header(packed); @@ -398,7 +398,7 @@ static bool Unpack_hpp32(wiegand_message_t *packed, wiegand_card_t *card) { memset(card, 0, sizeof(wiegand_card_t)); card->FacilityCode = get_linear_field(packed, 1, 12); - card->CardNumber = get_linear_field(packed, 13, 29); + card->CardNumber = get_linear_field(packed, 13, 18); return true; } @@ -627,20 +627,20 @@ static bool Pack_H10320(int format_idx, wiegand_card_t *card, wiegand_message_t // This card is BCD-encoded rather than binary. Set the 4-bit groups independently. for (uint32_t idx = 0; idx < 8; idx++) { - set_linear_field(packed, (uint64_t)(card->CardNumber / pow(10, 7 - idx)) % 10, idx * 4, 4); + set_linear_field(packed, (uint64_t)(card->CardNumber / pow(10, 7 - idx)) % 10, 1 + idx * 4, 4); } set_bit_by_position(packed, evenparity32( - get_nonlinear_field(packed, 8, (uint8_t[]) {0, 4, 8, 12, 16, 20, 24, 28}) - ), 32); - set_bit_by_position(packed, oddparity32( get_nonlinear_field(packed, 8, (uint8_t[]) {1, 5, 9, 13, 17, 21, 25, 29}) ), 33); - set_bit_by_position(packed, evenparity32( - get_nonlinear_field(packed, 8, (uint8_t[]) {2, 6, 10, 14, 18, 22, 28, 30}) + set_bit_by_position(packed, oddparity32( + get_nonlinear_field(packed, 8, (uint8_t[]) {2, 6, 10, 14, 18, 22, 26, 30}) ), 34); set_bit_by_position(packed, evenparity32( - get_nonlinear_field(packed, 8, (uint8_t[]) {3, 7, 11, 15, 19, 23, 29, 31}) + get_nonlinear_field(packed, 8, (uint8_t[]) {3, 7, 11, 15, 19, 23, 27, 31}) ), 35); + set_bit_by_position(packed, evenparity32( + get_nonlinear_field(packed, 8, (uint8_t[]) {4, 8, 12, 16, 20, 24, 28, 32}) + ), 36); if (preamble) return add_HID_header(packed); return true; @@ -657,7 +657,7 @@ static bool Unpack_H10320(wiegand_message_t *packed, wiegand_card_t *card) { // This card is BCD-encoded rather than binary. Get the 4-bit groups independently. for (uint32_t idx = 0; idx < 8; idx++) { - uint64_t val = get_linear_field(packed, idx * 4, 4); + uint64_t val = get_linear_field(packed, 1 + idx * 4, 4); if (val > 9) { // Violation of BCD; Zero and exit. card->CardNumber = 0; @@ -667,10 +667,10 @@ static bool Unpack_H10320(wiegand_message_t *packed, wiegand_card_t *card) { } } card->ParityValid = - (get_bit_by_position(packed, 32) == evenparity32(get_nonlinear_field(packed, 8, (uint8_t[]) {0, 4, 8, 12, 16, 20, 24, 28}))) && - (get_bit_by_position(packed, 33) == oddparity32(get_nonlinear_field(packed, 8, (uint8_t[]) {1, 5, 9, 13, 17, 21, 25, 29}))) && - (get_bit_by_position(packed, 34) == evenparity32(get_nonlinear_field(packed, 8, (uint8_t[]) {2, 6, 10, 14, 18, 22, 28, 30}))) && - (get_bit_by_position(packed, 35) == evenparity32(get_nonlinear_field(packed, 8, (uint8_t[]) {3, 7, 11, 15, 19, 23, 29, 31}))); + (get_bit_by_position(packed, 33) == evenparity32(get_nonlinear_field(packed, 8, (uint8_t[]) {1, 5, 9, 13, 17, 21, 25, 29}))) && + (get_bit_by_position(packed, 34) == oddparity32(get_nonlinear_field(packed, 8, (uint8_t[]) {2, 6, 10, 14, 18, 22, 26, 30}))) && + (get_bit_by_position(packed, 35) == evenparity32(get_nonlinear_field(packed, 8, (uint8_t[]) {3, 7, 11, 15, 19, 23, 27, 31}))) && + (get_bit_by_position(packed, 36) == evenparity32(get_nonlinear_field(packed, 8, (uint8_t[]) {4, 8, 12, 16, 20, 24, 28, 32}))); return true; } @@ -726,7 +726,6 @@ static bool Pack_S12906b(int format_idx, wiegand_card_t *card, wiegand_message_t if (!validate_card_limit(format_idx, card)) return false; if (card->FacilityCode != S12906b_FACILITY_CODE) return false; if (card->IssueLevel != 0u) return false; // This card does not support issue levels - if (!card->ParityValid) return false; // Cannot intentionally guess which parity caller wants to invalidate if (card->OEM != 0u) return false; // Card does not support OEM values packed->Length = 36; // Set number of bits @@ -950,7 +949,7 @@ static bool Unpack_HGeneric37(wiegand_message_t *packed, wiegand_card_t *card) { card->CardNumber = get_linear_field(packed, 4, 32); card->ParityValid = (get_bit_by_position(packed, 0) == evenparity32(get_nonlinear_field(packed, 8, (uint8_t[]) {4, 8, 12, 16, 20, 24, 28, 32}))) && - (get_bit_by_position(packed, 2) == oddparity32(get_nonlinear_field(packed, 8, (uint8_t[]) {6, 10, 14, 18, 22, 28, 30, 34}))) && + (get_bit_by_position(packed, 2) == oddparity32(get_nonlinear_field(packed, 8, (uint8_t[]) {6, 10, 14, 18, 22, 26, 30, 34}))) && (get_bit_by_position(packed, 3) == evenparity32(get_nonlinear_field(packed, 8, (uint8_t[]) {7, 11, 15, 19, 23, 27, 31, 35}))) ; return true; @@ -1562,16 +1561,16 @@ static const cardformat_t FormatTable[] = { {"ind29", Pack_ind29, Unpack_ind29, "Indala 29-bit", 29, {1, 1, 0, 0, 0, 0x00001FFFu, 0x000000000000FFFFu, 0x00000000u, 0x00000000u}}, // from cardinfo.barkweb.com.au {"ATSW30", Pack_ATSW30, Unpack_ATSW30, "ATS Wiegand 30-bit", 30, {1, 1, 0, 0, 1, 0x00000FFFu, 0x000000000000FFFFu, 0x00000000u, 0x00000000u}}, // from cardinfo.barkweb.com.au {"ADT31", Pack_ADT31, Unpack_ADT31, "HID ADT 31-bit", 31, {1, 1, 0, 0, 0, 0x0000000Fu, 0x00000000007FFFFFu, 0x00000000u, 0x00000000u}}, // from cardinfo.barkweb.com.au - {"HCP32", Pack_hcp32, Unpack_hcp32, "HID Check Point 32-bit", 32, {1, 0, 0, 0, 0, 0x00000000u, 0x0000000000003FFFu, 0x00000000u, 0x00000000u}}, // from cardinfo.barkweb.com.au - {"HPP32", Pack_hpp32, Unpack_hpp32, "HID Hewlett-Packard 32-bit", 32, {1, 1, 0, 0, 0, 0x00000FFFu, 0x000000001FFFFFFFu, 0x00000000u, 0x00000000u}}, // from cardinfo.barkweb.com.au + {"HCP32", Pack_hcp32, Unpack_hcp32, "HID Check Point 32-bit", 32, {1, 0, 0, 0, 0, 0x00000000u, 0x0000000000FFFFFFu, 0x00000000u, 0x00000000u}}, // from cardinfo.barkweb.com.au + {"HPP32", Pack_hpp32, Unpack_hpp32, "HID Hewlett-Packard 32-bit", 32, {1, 1, 0, 0, 0, 0x00000FFFu, 0x000000000003FFFFu, 0x00000000u, 0x00000000u}}, // from cardinfo.barkweb.com.au {"Kastle", Pack_Kastle, Unpack_Kastle, "Kastle 32-bit", 32, {1, 1, 1, 0, 1, 0x000000FFu, 0x000000000000FFFFu, 0x0000001Fu, 0x00000000u}}, // from @xilni; PR #23 on RfidResearchGroup/proxmark3 {"Kantech", Pack_Kantech, Unpack_Kantech, "Indala/Kantech KFS 32-bit", 32, {1, 1, 0, 0, 0, 0x000000FFu, 0x000000000000FFFFu, 0x00000000u, 0x00000000u}}, // from cardinfo.barkweb.com.au {"WIE32", Pack_wie32, Unpack_wie32, "Wiegand 32-bit", 32, {1, 1, 0, 0, 0, 0x00000FFFu, 0x000000000000FFFFu, 0x00000000u, 0x00000000u}}, // from cardinfo.barkweb.com.au {"D10202", Pack_D10202, Unpack_D10202, "HID D10202 33-bit", 33, {1, 1, 0, 0, 1, 0x0000007Fu, 0x0000000000FFFFFFu, 0x00000000u, 0x00000000u}}, // from cardinfo.barkweb.com.au {"H10306", Pack_H10306, Unpack_H10306, "HID H10306 34-bit", 34, {1, 1, 0, 0, 1, 0x0000FFFFu, 0x000000000000FFFFu, 0x00000000u, 0x00000000u}}, // imported from old pack/unpack {"N10002", Pack_N10002, Unpack_N10002, "Honeywell/Northern N10002 34-bit", 34, {1, 1, 0, 0, 1, 0x0000FFFFu, 0x000000000000FFFFu, 0x00000000u, 0x00000000u}}, // from proxclone.com - {"Optus34", Pack_Optus, Unpack_Optus, "Indala Optus 34-bit", 34, {1, 1, 0, 0, 0, 0x000003FFu, 0x000000000000FFFFu, 0x00000000u, 0x00000000u}}, // from cardinfo.barkweb.com.au - {"SMP34", Pack_Smartpass, Unpack_Smartpass, "Cardkey Smartpass 34-bit", 34, {1, 1, 1, 0, 0, 0x000003FFu, 0x000000000000FFFFu, 0x00000007u, 0x00000000u}}, // from cardinfo.barkweb.com.au + {"Optus34", Pack_Optus, Unpack_Optus, "Indala Optus 34-bit", 34, {1, 1, 0, 0, 0, 0x000007FFu, 0x000000000000FFFFu, 0x00000000u, 0x00000000u}}, // from cardinfo.barkweb.com.au + {"SMP34", Pack_Smartpass, Unpack_Smartpass, "Cardkey Smartpass 34-bit", 34, {1, 1, 1, 0, 0, 0x00001FFFu, 0x000000000000FFFFu, 0x00000007u, 0x00000000u}}, // from cardinfo.barkweb.com.au {"BQT34", Pack_bqt34, Unpack_bqt34, "BQT 34-bit", 34, {1, 1, 0, 0, 1, 0x000000FFu, 0x0000000000FFFFFFu, 0x00000000u, 0x00000000u}}, // from cardinfo.barkweb.com.au {"C1k35s", Pack_C1k35s, Unpack_C1k35s, "HID Corporate 1000 35-bit std", 35, {1, 1, 0, 0, 1, 0x00000FFFu, 0x00000000000FFFFFu, 0x00000000u, 0x00000000u}}, // imported from old pack/unpack {"C15001", Pack_C15001, Unpack_C15001, "HID KeyScan 36-bit", 36, {1, 1, 0, 1, 1, 0x000000FFu, 0x000000000000FFFFu, 0x00000000u, 0x000003FFu}}, // from Proxmark forums @@ -1582,15 +1581,15 @@ static const cardformat_t FormatTable[] = { {"H10302", Pack_H10302, Unpack_H10302, "HID H10302 37-bit huge ID", 37, {1, 0, 0, 0, 1, 0x00000000u, 0x00000007FFFFFFFFu, 0x00000000u, 0x00000000u}}, // from Proxmark forums {"H10304", Pack_H10304, Unpack_H10304, "HID H10304 37-bit", 37, {1, 1, 0, 0, 1, 0x0000FFFFu, 0x000000000007FFFFu, 0x00000000u, 0x00000000u}}, // from cardinfo.barkweb.com.au {"P10004", Pack_P10004, Unpack_P10004, "HID P10004 37-bit PCSC", 37, {1, 1, 0, 0, 0, 0x00001FFFu, 0x000000000003FFFFu, 0x00000000u, 0x00000000u}}, // from @bthedorff; PR #1559 - {"HGen37", Pack_HGeneric37, Unpack_HGeneric37, "HID Generic 37-bit", 37, {1, 0, 0, 0, 1, 0x00000000u, 0x000000000007FFFFu, 0x00000000u, 0x00000000u}}, // from cardinfo.barkweb.com.au + {"HGen37", Pack_HGeneric37, Unpack_HGeneric37, "HID Generic 37-bit", 37, {1, 0, 0, 0, 1, 0x00000000u, 0x00000000FFFFFFFFu, 0x00000000u, 0x00000000u}}, // from cardinfo.barkweb.com.au {"MDI37", Pack_MDI37, Unpack_MDI37, "PointGuard MDI 37-bit", 37, {1, 1, 0, 0, 1, 0x0000000Fu, 0x000000001FFFFFFFu, 0x00000000u, 0x00000000u}}, // from cardinfo.barkweb.com.au - {"BQT38", Pack_bqt38, Unpack_bqt38, "BQT 38-bit", 38, {1, 1, 1, 0, 1, 0x00000FFFu, 0x000000000003FFFFu, 0x00000007u, 0x00000000u}}, // from cardinfo.barkweb.com.au - {"ISCS", Pack_iscs38, Unpack_iscs38, "ISCS 38-bit", 38, {1, 1, 0, 1, 1, 0x000003FFu, 0x0000000000FFFFFFu, 0x00000000u, 0x00000007u}}, // from cardinfo.barkweb.com.au - {"PW39", Pack_pw39, Unpack_pw39, "Pyramid 39-bit wiegand format", 39, {1, 1, 0, 0, 1, 0x0000FFFFu, 0x00000000000FFFFFu, 0x00000000u, 0x00000000u}}, // from cardinfo.barkweb.com.au + {"BQT38", Pack_bqt38, Unpack_bqt38, "BQT 38-bit", 38, {1, 1, 1, 0, 1, 0x00001FFFu, 0x000000000007FFFFu, 0x0000000Fu, 0x00000000u}}, // from cardinfo.barkweb.com.au + {"ISCS", Pack_iscs38, Unpack_iscs38, "ISCS 38-bit", 38, {1, 1, 0, 1, 1, 0x000003FFu, 0x00000000003FFFFFu, 0x00000000u, 0x0000000Fu}}, // from cardinfo.barkweb.com.au + {"PW39", Pack_pw39, Unpack_pw39, "Pyramid 39-bit wiegand format", 39, {1, 1, 0, 0, 1, 0x0001FFFFu, 0x00000000000FFFFFu, 0x00000000u, 0x00000000u}}, // from cardinfo.barkweb.com.au {"P10001", Pack_P10001, Unpack_P10001, "HID P10001 Honeywell 40-bit", 40, {1, 1, 0, 0, 0, 0x00000FFFu, 0x000000000000FFFFu, 0x00000000u, 0x00000000u}}, // from cardinfo.barkweb.com.au - {"Casi40", Pack_CasiRusco40, Unpack_CasiRusco40, "Casi-Rusco 40-bit", 40, {1, 0, 0, 0, 0, 0x00000000u, 0x000000FFFFFFFFFFu, 0x00000000u, 0x00000000u}}, // from cardinfo.barkweb.com.au + {"Casi40", Pack_CasiRusco40, Unpack_CasiRusco40, "Casi-Rusco 40-bit", 40, {1, 0, 0, 0, 0, 0x00000000u, 0x0000003FFFFFFFFFu, 0x00000000u, 0x00000000u}}, // from cardinfo.barkweb.com.au {"Verkada40", Pack_Verkada40, Unpack_Verkada40, "Verkada 40-bit", 40, {1, 1, 0, 0, 1, 0x000003FFu, 0x000000000FFFFFFFu, 0x00000000u, 0x00000000u}}, // Verkada 40-bit format - {"BC40", Pack_bc40, Unpack_bc40, "Bundy TimeClock 40-bit", 40, {1, 1, 0, 1, 1, 0x00000FFFu, 0x00000000000FFFFFu, 0x00000000u, 0x0000007Fu}}, // from + {"BC40", Pack_bc40, Unpack_bc40, "Bundy TimeClock 40-bit", 40, {1, 1, 0, 1, 1, 0x00000FFFu, 0x000000000007FFFFu, 0x00000000u, 0x0000007Fu}}, // from {"Defcon32", Pack_Defcon32, Unpack_Defcon32, "Custom Defcon RFCTF 42-bit", 42, {1, 1, 1, 0, 1, 0x0000FFFFu, 0x00000000000FFFFFu, 0x0000000Fu, 0x00000000u}}, // Created by (@micsen) for the CTF {"H800002", Pack_H800002, Unpack_H800002, "HID H800002 46-bit", 46, {1, 1, 0, 0, 1, 0x00003FFFu, 0x000000003FFFFFFFu, 0x00000000u, 0x00000000u}}, {"C1k48s", Pack_C1k48s, Unpack_C1k48s, "HID Corporate 1000 48-bit std", 48, {1, 1, 0, 0, 1, 0x003FFFFFu, 0x00000000007FFFFFu, 0x00000000u, 0x00000000u}}, // imported from old pack/unpack diff --git a/doc/commands.json b/doc/commands.json index fd2b16458..f497c5fcf 100644 --- a/doc/commands.json +++ b/doc/commands.json @@ -16806,12 +16806,12 @@ "options": [ "-h, --help This help" ], - "usage": "wiegand info [-h]" + "usage": "wiegand list [-h]" } }, "metadata": { "commands_extracted": 936, "extracted_by": "PM3Help2JSON v1.00", - "extracted_on": "2026-10-23T22:15:17+00:00" + "extracted_on": "2026-11-06T22:34:07+00:00" } } diff --git a/tools/pm3_tests.sh b/tools/pm3_tests.sh index 675fdd4dd..e4033a677 100755 --- a/tools/pm3_tests.sh +++ b/tools/pm3_tests.sh @@ -494,6 +494,7 @@ while true; do if ! CheckExecute "nfc decode test signature" "$CLIENTBIN -c 'nfc decode -d 03FF010194113870696C65742E65653A656B616172743A3266195F26063132303832325904202020205F28033233335F2701316E1B5A13333038363439303039303030323636343030355304EBF2CE704103000000AC536967010200803A2448FCA7D354A654A81BD021150D1A152D1DF4D7A55D2B771F12F094EAB6E5E10F2617A2F8DAD4FD38AFF8EA39B71C19BD42618CDA86EE7E144636C8E0E7CFC4096E19C3680E09C78A0CDBC05DA2D698E551D5D709717655E56FE3676880B897D2C70DF5F06ECE07C71435255144F8EE41AF110E7B180DA0E6C22FB8FDEF61800025687474703A2F2F70696C65742E65652F6372742F33303836343930302D303030312E637274FE'" "30864900-0001.crt"; then break; fi if ! CheckExecute "nfc decode test openprinter tag" "$CLIENTBIN -c 'nfc decode -d 03FF012F91013A55046E756D616B6572732E636F6D2F70726F64756374732F6162732D66696C616D656E743F76617269616E743D3436393434323937333836323932521CD26170706C69636174696F6E2F766E642E6F70656E7072696E74746167A10218AFBF041B000007D0FCAB45F9080009020A70414253204C656D6F6E2059656C6C6F770B684E756D616B6572730E1A69094200101903E81119041A1218F01343F9A800181DF93C29182218F01823190104182418AA1825185A18261864FF00'" "application/vnd.openprinttag"; then break; fi + if ! CheckExecute "wiegand list usage" "$CLIENTBIN -c 'wiegand list -h'" "wiegand list \[-h\]"; then break; fi if ! CheckExecute "wiegand encode new" "$CLIENTBIN -c 'wiegand encode -w H10301 --fc 123 --cn 4567 --new'" "New PACS\\.{9} 0x 06BD88EB80"; then break; fi if ! CheckExecute "wiegand encode bin" "$CLIENTBIN -c 'wiegand encode --bin 1'" "Wiegand raw\\.{4} 03"; then break; fi if ! CheckExecute "wiegand encode new bin" "$CLIENTBIN -c 'wiegand encode --bin 1 --new'" "New PACS\\.{9} 0x 0780"; then break; fi @@ -507,6 +508,38 @@ while true; do if ! CheckExecute "wiegand encode new bin 96-bit raw" "PAT=\$(printf '01%.0s' {1..48}); $CLIENTBIN -c \"wiegand encode --bin \$PAT --new --verbose\"" "Wiegand --raw\\.{4} 0x 01555555555555555555555555"; then break; fi if ! CheckExecute "wiegand encode new 48-bit" "$CLIENTBIN -c 'wiegand encode -w C1k48s --fc 42069 --cn 42069 --new'" "New PACS\\.{9} 0x 0000A4550148AB"; then break; fi if ! CheckExecute "wiegand decode raw over 96-bit" "$CLIENTBIN -c 'wiegand decode --raw 01555555555555555555555555' 2>&1" "Raw hex decode supports up to 96 Wiegand bits"; then break; fi + if ! CheckExecute "wiegand encode HCP32 max" "$CLIENTBIN -c 'wiegand encode -w HCP32 --cn 16777215 --new'" "New PACS\\.{9} 0x 007FFFFF80"; then break; fi + if ! CheckExecute "wiegand decode HCP32 max" "$CLIENTBIN -c 'wiegand decode --new 007FFFFF80'" "\[HCP32 +\] HID Check Point 32-bit +CN: 16777215"; then break; fi + if ! CheckExecute "wiegand encode HPP32 max" "$CLIENTBIN -c 'wiegand encode -w HPP32 --fc 4095 --cn 262143 --new'" "New PACS\\.{9} 0x 007FFFFFFE"; then break; fi + if ! CheckExecute "wiegand decode HPP32 max" "$CLIENTBIN -c 'wiegand decode --new 007FFFFFFE'" "\[HPP32 +\] HID Hewlett-Packard 32-bit +FC: 4095 CN: 262143"; then break; fi + if ! CheckExecute "wiegand encode HPP32 over max" "$CLIENTBIN -c 'wiegand encode -w HPP32 --fc 1 --cn 262144' 2>&1" "could not be encoded in the selected format"; then break; fi + if ! CheckExecute "wiegand encode Optus34 max" "$CLIENTBIN -c 'wiegand encode -w Optus34 --fc 2047 --cn 65535 --new'" "New PACS\\.{9} 0x 067FFF83FF80"; then break; fi + if ! CheckExecute "wiegand decode Optus34 max" "$CLIENTBIN -c 'wiegand decode --new 067FFF83FF80'" "\[Optus34 +\] Indala Optus 34-bit +FC: 2047 CN: 65535"; then break; fi + if ! CheckExecute "wiegand encode SMP34 max" "$CLIENTBIN -c 'wiegand encode -w SMP34 --fc 8191 --cn 65535 --issue 7 --new'" "New PACS\\.{9} 0x 067FFFFFFF80"; then break; fi + if ! CheckExecute "wiegand decode SMP34 max" "$CLIENTBIN -c 'wiegand decode --new 067FFFFFFF80'" "\[SMP34 +\] Cardkey Smartpass 34-bit +FC: 8191 CN: 65535 Issue: 7"; then break; fi + if ! CheckExecute "wiegand encode S12906b max" "$CLIENTBIN -c 'wiegand encode -w S12906b --fc 217 --cn 16777215 --new'" "New PACS\\.{9} 0x 046CDFFFFFE0"; then break; fi + if ! CheckExecute "wiegand decode S12906b max" "$CLIENTBIN -c 'wiegand decode --new 046CDFFFFFE0'" "\[S12906b +\] HID Simplex Grinnell 36-bit +FC: 217 CN: 16777215 parity \( ok \)"; then break; fi + if ! CheckExecute "wiegand encode H10320 max" "$CLIENTBIN -c 'wiegand encode -w H10320 --cn 99999999 --new'" "New PACS\\.{9} 0x 03CCCCCCCCA0"; then break; fi + if ! CheckExecute "wiegand decode H10320 max" "$CLIENTBIN -c 'wiegand decode --new 03CCCCCCCCA0'" "\[H10320 +\] HID H10320 37-bit BCD +CN: 99999999 parity \( ok \)"; then break; fi + if ! CheckExecute "wiegand encode H10320 12345678" "$CLIENTBIN -c 'wiegand encode -w H10320 --cn 12345678 --new'" "New PACS\\.{9} 0x 03891A2B3C60"; then break; fi + if ! CheckExecute "wiegand decode H10320 12345678" "$CLIENTBIN -c 'wiegand decode --new 03891A2B3C60'" "\[H10320 +\] HID H10320 37-bit BCD +CN: 12345678 parity \( ok \)"; then break; fi + if ! CheckExecute "wiegand encode HGen37 max" "$CLIENTBIN -c 'wiegand encode -w HGen37 --cn 4294967295 --new'" "New PACS\\.{9} 0x 032FFFFFFFF8"; then break; fi + if ! CheckExecute "wiegand decode HGen37 max" "$CLIENTBIN -c 'wiegand decode --new 032FFFFFFFF8'" "\[HGen37 +\] HID Generic 37-bit +CN: 4294967295 parity \( ok \)"; then break; fi + if ! CheckExecute "wiegand encode HGen37 parity" "$CLIENTBIN -c 'wiegand encode -w HGen37 --cn 512 --new'" "New PACS\\.{9} 0x 030000002008"; then break; fi + if ! CheckExecute "wiegand decode HGen37 parity" "$CLIENTBIN -c 'wiegand decode --new 030000002008'" "\[HGen37 +\] HID Generic 37-bit +CN: 512 parity \( ok \)"; then break; fi + if ! CheckExecute "wiegand encode BQT38 max" "$CLIENTBIN -c 'wiegand encode -w BQT38 --fc 8191 --cn 524287 --issue 15 --new'" "New PACS\\.{9} 0x 027FFFFFFFFC"; then break; fi + if ! CheckExecute "wiegand decode BQT38 max" "$CLIENTBIN -c 'wiegand decode --new 027FFFFFFFFC'" "\[BQT38 +\] BQT 38-bit +FC: 8191 CN: 524287 Issue: 15 parity \( ok \)"; then break; fi + if ! CheckExecute "wiegand encode ISCS max" "$CLIENTBIN -c 'wiegand encode -w ISCS --fc 1023 --cn 4194303 --oem 15 --new'" "New PACS\\.{9} 0x 027FFFFFFFFC"; then break; fi + if ! CheckExecute "wiegand decode ISCS max" "$CLIENTBIN -c 'wiegand decode --new 027FFFFFFFFC'" "\[ISCS +\] ISCS 38-bit +FC: 1023 CN: 4194303 OEM: 15 parity \( ok \)"; then break; fi + if ! CheckExecute "wiegand encode ISCS over max" "$CLIENTBIN -c 'wiegand encode -w ISCS --fc 1 --cn 4194304' 2>&1" "could not be encoded in the selected format"; then break; fi + if ! CheckExecute "wiegand encode PW39 max" "$CLIENTBIN -c 'wiegand encode -w PW39 --fc 131071 --cn 1048575 --new'" "New PACS\\.{9} 0x 017FFFFFFFFC"; then break; fi + if ! CheckExecute "wiegand decode PW39 max" "$CLIENTBIN -c 'wiegand decode --new 017FFFFFFFFC'" "\[PW39 +\] Pyramid 39-bit wiegand format +FC: 131071 CN: 1048575 parity \( ok \)"; then break; fi + if ! CheckExecute "wiegand encode Casi40 max" "$CLIENTBIN -c 'wiegand encode -w Casi40 --cn 274877906943 --new'" "New PACS\\.{9} 0x 007FFFFFFFFE"; then break; fi + if ! CheckExecute "wiegand decode Casi40 max" "$CLIENTBIN -c 'wiegand decode --new 007FFFFFFFFE'" "\[Casi40 +\] Casi-Rusco 40-bit +CN: 274877906943"; then break; fi + if ! CheckExecute "wiegand encode Casi40 over max" "$CLIENTBIN -c 'wiegand encode -w Casi40 --cn 274877906944' 2>&1" "could not be encoded in the selected format"; then break; fi + if ! CheckExecute "wiegand encode BC40 max" "$CLIENTBIN -c 'wiegand encode -w BC40 --fc 4095 --cn 524287 --oem 127 --new'" "New PACS\\.{9} 0x 00FFFFFFFFFC"; then break; fi + if ! CheckExecute "wiegand decode BC40 max" "$CLIENTBIN -c 'wiegand decode --new 00FFFFFFFFFC'" "\[BC40 +\] Bundy TimeClock 40-bit +FC: 4095 CN: 524287 OEM: 127 parity \( ok \)"; then break; fi + if ! CheckExecute "wiegand encode BC40 over max" "$CLIENTBIN -c 'wiegand encode -w BC40 --fc 1 --cn 524288' 2>&1" "could not be encoded in the selected format"; then break; fi if ! CheckExecute "wiegand decode raw" "$CLIENTBIN -c 'wiegand decode --raw 2006F623AE'" "FC: 123 CN: 4567 parity \( ok \)"; then break; fi if ! CheckExecute "wiegand decode bin over 96-bit" "PAT=\$(printf '01%.0s' {1..49}); $CLIENTBIN -c \"wiegand decode --bin \$PAT\" 2>&1" "Binary decode supports up to 96 Wiegand bits"; then break; fi if ! CheckExecute "wiegand decode new" "$CLIENTBIN -c 'wiegand decode --new 06BD88EB80'" "FC: 123 CN: 4567 parity \( ok \)"; then break; fi