+ uint32_t oem;
+ uint32_t fmtlen = 0;
+ uint32_t fc, lo = 0, hi = 0;
+ uint64_t cn = 0;
+ uint32_t cardnum = 0;
+
+ //uint32_t temp, p
+ uint8_t ctmp = param_getchar(Cmd, 0);
+ if ( strlen(Cmd) < 0 || strlen(Cmd) < 4 || ctmp == 'H' || ctmp == 'h' ) return usage_hid_wiegand();
+
+ fmtlen = param_get8(Cmd, 0);
+ oem = param_get8(Cmd, 1);
+ fc = param_get32ex(Cmd, 2, 0, 10);
+ cn = param_get64ex(Cmd, 3, 0, 10);
+
+ switch ( fmtlen ) {
+ case 26 : {
+ cardnum = (cn & 0xFFFFFFFF);
+ calc26(fc, cardnum, &hi, &lo);
+ getParity26(&hi, &lo);
+ break;
+ }
+ case 34 : {
+ cardnum = (cn & 0xFFFFFFFF);
+ calc34(fc, cardnum, &hi, &lo);
+ getParity34(&hi, &lo);
+ break;
+ }
+ case 35 : {
+ cardnum = (cn & 0xFFFFFFFF);
+ calc35(fc, cardnum, &hi, &lo);
+ getParity35(&hi, &lo);
+ break;
+ }
+ case 37 : {
+ cardnum = (cn & 0xFFFFFFFF);
+ calc37S(fc, cardnum, &hi, &lo);
+ getParity37S(&hi, &lo);
+ break;
+ }
+ case 38 : {
+ cardnum = (cn & 0xFFFFFFFF);
+ calc37H(cardnum, &hi, &lo);
+ getParity37H(&hi, &lo);
+ break;
+ }
+ case 40 : {
+ calc40(cn, &hi, &lo);
+ break;
+ }
+ case 44 : { break; }
+ case 84 : { break; }
+ }
+ PrintAndLog("HID %d bit | FC: %d CN: %lld | Wiegand Code: %08X%08X", fmtlen, fc, cn, hi, lo);
+ return 0;
+}
+
+static command_t CommandTable[] = {
+ {"help", CmdHelp, 1, "This help"},
+ //{"demod", CmdHIDDemod, 1, "Demodulate HID Prox Card II (not optimal)"},
+ {"fskdemod", CmdHIDDemodFSK, 0, "['1'] Realtime HID FSK demodulator (option '1' for one tag only)"},
+ {"sim", CmdHIDSim, 0, "<ID> -- HID tag simulator"},
+ {"clone", CmdHIDClone, 0, "<ID> ['l'] -- Clone HID to T55x7 (tag must be in antenna)(option 'l' for 84bit ID)"},
+ {"wiegand", CmdHIDWiegand, 1, "<oem> <fmtlen> <fc> <cardnum> -- convert facilitycode, cardnumber to Wiegand code"},
+ {NULL, NULL, 0, NULL}
+};
+
+int CmdLFHID(const char *Cmd) {
+ CmdsParse(CommandTable, Cmd);
+ return 0;
+}
+
+int CmdHelp(const char *Cmd) {
+ CmdsHelp(CommandTable);
+ return 0;