+#define SESSION_IV 0x55
+#define MAX_LENGTH 1024
+
+int usage_legic_calccrc8(void){
+ PrintAndLog("Calculates the legic crc8/crc16 on the input hexbytes.");
+ PrintAndLog("There must be an even number of hexsymbols as input.");
+ PrintAndLog("Usage: hf legic crc8 [h] b <hexbytes> u <uidcrc> c <crc type>");
+ PrintAndLog("Options:");
+ PrintAndLog(" h : this help");
+ PrintAndLog(" b <hexbytes> : hex bytes");
+ PrintAndLog(" u <uidcrc> : MCC hexbyte");
+ PrintAndLog(" c <crc type> : 8|16 bit crc size");
+ PrintAndLog("");
+ PrintAndLog("Samples:");
+ PrintAndLog(" hf legic crc8 b deadbeef1122");
+ PrintAndLog(" hf legic crc8 b deadbeef1122 u 9A c 16");
+ return 0;
+}
+int usage_legic_load(void){
+ PrintAndLog("It loads datasamples from the file `filename` to device memory");
+ PrintAndLog("Usage: hf legic load [h] <file name>");
+ PrintAndLog("Options:");
+ PrintAndLog(" h : this help");
+ PrintAndLog(" <filename> : Name of file to load");
+ PrintAndLog("");
+ PrintAndLog("Samples:");
+ PrintAndLog(" hf legic load filename");
+ return 0;
+}
+int usage_legic_read(void){
+ PrintAndLog("Read data from a legic tag.");
+ PrintAndLog("Usage: hf legic read [h] <offset> <length> <IV>");
+ PrintAndLog("Options:");
+ PrintAndLog(" h : this help");
+ PrintAndLog(" <offset> : offset in data array to start download from");
+ PrintAndLog(" <length> : number of bytes to download");
+ PrintAndLog(" <IV> : (optional) Initialization vector to use");
+ PrintAndLog("");
+ PrintAndLog("Samples:");
+ PrintAndLog(" hf legic read");
+ PrintAndLog(" hf legic read 10 4");
+ return 0;
+}
+int usage_legic_sim(void){
+ PrintAndLog("Missing help text.");
+ return 0;
+}
+int usage_legic_write(void){
+ PrintAndLog(" Write sample buffer to a legic tag. (use after load or read)");
+ PrintAndLog("Usage: hf legic write [h] <offset> <length> <IV>");
+ PrintAndLog("Options:");
+ PrintAndLog(" h : this help");
+ PrintAndLog(" <offset> : offset in data array to start writing from");
+ PrintAndLog(" <length> : number of bytes to write");
+ PrintAndLog(" <IV> : (optional) Initialization vector to use");
+ PrintAndLog("");
+ PrintAndLog("Samples:");
+ PrintAndLog(" hf legic write");
+ PrintAndLog(" hf legic write 10 4");
+ return 0;
+}
+int usage_legic_rawwrite(void){
+ PrintAndLog("Write raw data direct to a specific address on legic tag.");
+ PrintAndLog("Usage: hf legic writeraw [h] <address> <value> <IV>");
+ PrintAndLog("Options:");
+ PrintAndLog(" h : this help");
+ PrintAndLog(" <address> : address to write to");
+ PrintAndLog(" <value> : value to write");
+ PrintAndLog(" <IV> : (optional) Initialization vector to use");
+ PrintAndLog("");
+ PrintAndLog("Samples:");
+ PrintAndLog(" hf legic writeraw");
+ PrintAndLog(" hf legic writeraw 10 4");
+ return 0;
+}
+int usage_legic_fill(void){
+ PrintAndLog("Missing help text.");
+ return 0;
+}
+