mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-02-12 18:25:07 +08:00
arg names
This commit is contained in:
parent
ebdfba033d
commit
51d6fa13eb
32 changed files with 69 additions and 69 deletions
|
@ -271,7 +271,7 @@ struct arg_date *arg_daten(const char *shortopts,
|
|||
int maxcount,
|
||||
const char *glossary);
|
||||
|
||||
struct arg_end *arg_end(int maxerrors);
|
||||
struct arg_end *arg_end(int maxcount);
|
||||
|
||||
|
||||
/**** other functions *******************************************/
|
||||
|
|
|
@ -32,9 +32,9 @@
|
|||
#define CLIGetStrWithReturn(paramnum, data, datalen) if (CLIParamStrToBuf(arg_get_str(paramnum), data, sizeof(data), datalen)) {CLIParserFree();return 1;}
|
||||
|
||||
int CLIParserInit(char *vprogramName, char *vprogramHint, char *vprogramHelp);
|
||||
int CLIParserParseString(const char *str, void *argtable[], size_t vargtableLen, bool allowEmptyExec);
|
||||
int CLIParserParseString(const char *str, void *vargtable[], size_t vargtableLen, bool allowEmptyExec);
|
||||
int CLIParserParseStringEx(const char *str, void *vargtable[], size_t vargtableLen, bool allowEmptyExec, bool clueData);
|
||||
int CLIParserParseArg(int argc, char **argv, void *argtable[], size_t vargtableLen, bool allowEmptyExec);
|
||||
int CLIParserParseArg(int argc, char **argv, void *vargtable[], size_t vargtableLen, bool allowEmptyExec);
|
||||
void CLIParserFree();
|
||||
|
||||
int CLIParamHexToBuf(struct arg_str *argstr, uint8_t *data, int maxdatalen, int *datalen);
|
||||
|
|
|
@ -237,26 +237,26 @@ int usage_data_fsktonrz() {
|
|||
|
||||
//set the demod buffer with given array of binary (one bit per byte)
|
||||
//by marshmellow
|
||||
void setDemodBuf(uint8_t *buf, size_t size, size_t start_idx) {
|
||||
if (buf == NULL) return;
|
||||
void setDemodBuff(uint8_t *buff, size_t size, size_t start_idx) {
|
||||
if (buff == NULL) return;
|
||||
|
||||
if (size > MAX_DEMOD_BUF_LEN - start_idx)
|
||||
size = MAX_DEMOD_BUF_LEN - start_idx;
|
||||
|
||||
for (size_t i = 0; i < size; i++)
|
||||
DemodBuffer[i] = buf[start_idx++];
|
||||
DemodBuffer[i] = buff[start_idx++];
|
||||
|
||||
DemodBufferLen = size;
|
||||
}
|
||||
|
||||
bool getDemodBuf(uint8_t *buf, size_t *size) {
|
||||
if (buf == NULL) return false;
|
||||
bool getDemodBuff(uint8_t *buff, size_t *size) {
|
||||
if (buff == NULL) return false;
|
||||
if (size == NULL) return false;
|
||||
if (*size == 0) return false;
|
||||
|
||||
*size = (*size > DemodBufferLen) ? DemodBufferLen : *size;
|
||||
|
||||
memcpy(buf, DemodBuffer, *size);
|
||||
memcpy(buff, DemodBuffer, *size);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -521,7 +521,7 @@ int ASKDemod_ext(const char *Cmd, bool verbose, bool emSearch, uint8_t askType,
|
|||
if (verbose) PrintAndLogEx(DEBUG, "DEBUG: (ASKDemod_ext) Using clock:%d, invert:%d, bits found:%d", clk, invert, BitLen);
|
||||
|
||||
//output
|
||||
setDemodBuf(bits, BitLen, 0);
|
||||
setDemodBuff(bits, BitLen, 0);
|
||||
setClockGrid(clk, startIdx);
|
||||
|
||||
if (verbose) {
|
||||
|
@ -608,7 +608,7 @@ int Cmdmandecoderaw(const char *Cmd) {
|
|||
size_t idx = 0;
|
||||
if (Em410xDecode(bits, &size, &idx, &hi, &id) == 1) {
|
||||
//need to adjust to set bitstream back to manchester encoded data
|
||||
//setDemodBuf(bits, size, idx);
|
||||
//setDemodBuff(bits, size, idx);
|
||||
printEM410x(hi, id);
|
||||
}
|
||||
}
|
||||
|
@ -638,7 +638,7 @@ int CmdBiphaseDecodeRaw(const char *Cmd) {
|
|||
|
||||
uint8_t bits[MAX_DEMOD_BUF_LEN] = {0};
|
||||
size = sizeof(bits);
|
||||
if (!getDemodBuf(bits, &size)) return 0;
|
||||
if (!getDemodBuff(bits, &size)) return 0;
|
||||
|
||||
errCnt = BiphaseRawDecode(bits, &size, &offset, invert);
|
||||
if (errCnt < 0) {
|
||||
|
@ -658,7 +658,7 @@ int CmdBiphaseDecodeRaw(const char *Cmd) {
|
|||
|
||||
//remove first bit from raw demod
|
||||
if (offset)
|
||||
setDemodBuf(DemodBuffer, DemodBufferLen - offset, offset);
|
||||
setDemodBuff(DemodBuffer, DemodBufferLen - offset, offset);
|
||||
|
||||
setClockGrid(g_DemodClock, g_DemodStartIdx + g_DemodClock * offset / 2);
|
||||
return 1;
|
||||
|
@ -696,7 +696,7 @@ int ASKbiphaseDemod(const char *Cmd, bool verbose) {
|
|||
return 0;
|
||||
}
|
||||
//success set DemodBuffer and return
|
||||
setDemodBuf(BitStream, size, 0);
|
||||
setDemodBuff(BitStream, size, 0);
|
||||
setClockGrid(clk, startIdx + clk * offset / 2);
|
||||
if (g_debugMode || verbose) {
|
||||
PrintAndLogEx(NORMAL, "Biphase Decoded using offset: %d - clock: %d - # errors:%d - data:", offset, clk, errCnt);
|
||||
|
@ -1067,7 +1067,7 @@ int FSKrawDemod(const char *Cmd, bool verbose) {
|
|||
int startIdx = 0;
|
||||
int size = fskdemod(bits, BitLen, rfLen, invert, fchigh, fclow, &startIdx);
|
||||
if (size > 0) {
|
||||
setDemodBuf(bits, size, 0);
|
||||
setDemodBuff(bits, size, 0);
|
||||
setClockGrid(rfLen, startIdx);
|
||||
|
||||
// Now output the bitstream to the scrollback by line of 16 bits
|
||||
|
@ -1135,7 +1135,7 @@ int PSKDemod(const char *Cmd, bool verbose) {
|
|||
}
|
||||
}
|
||||
//prime demod buffer for output
|
||||
setDemodBuf(bits, bitlen, 0);
|
||||
setDemodBuff(bits, bitlen, 0);
|
||||
setClockGrid(clk, startIdx);
|
||||
return 1;
|
||||
}
|
||||
|
@ -1185,7 +1185,7 @@ int CmdIdteckDemod(const char *Cmd) {
|
|||
return 0;
|
||||
}
|
||||
}
|
||||
setDemodBuf(DemodBuffer, 64, idx);
|
||||
setDemodBuff(DemodBuffer, 64, idx);
|
||||
|
||||
//got a good demod
|
||||
uint32_t id = 0;
|
||||
|
@ -1238,7 +1238,7 @@ int NRZrawDemod(const char *Cmd, bool verbose) {
|
|||
}
|
||||
if (verbose || g_debugMode) PrintAndLogEx(DEBUG, "DEBUG: (NRZrawDemod) Tried NRZ Demod using Clock: %d - invert: %d - Bits Found: %d", clk, invert, BitLen);
|
||||
//prime demod buffer for output
|
||||
setDemodBuf(bits, BitLen, 0);
|
||||
setDemodBuff(bits, BitLen, 0);
|
||||
setClockGrid(clk, clkStartIdx);
|
||||
|
||||
|
||||
|
|
|
@ -36,8 +36,8 @@ command_t *CmdDataCommands();
|
|||
|
||||
int CmdData(const char *Cmd);
|
||||
void printDemodBuff(void);
|
||||
void setDemodBuf(uint8_t *buff, size_t size, size_t startIdx);
|
||||
bool getDemodBuf(uint8_t *buff, size_t *size);
|
||||
void setDemodBuff(uint8_t *buff, size_t size, size_t start_idx);
|
||||
bool getDemodBuff(uint8_t *buff, size_t *size);
|
||||
void save_restoreDB(uint8_t saveOpt);// option '1' to save DemodBuffer any other to restore
|
||||
int CmdPrintDemodBuff(const char *Cmd);
|
||||
|
||||
|
|
|
@ -509,7 +509,7 @@ int CmdLFfskSim(const char *Cmd) {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
setDemodBuf(data, dataLen, 0);
|
||||
setDemodBuff(data, dataLen, 0);
|
||||
}
|
||||
|
||||
//default if not found
|
||||
|
@ -603,7 +603,7 @@ int CmdLFaskSim(const char *Cmd) {
|
|||
if (clk == 0)
|
||||
clk = GetAskClock("0", false);
|
||||
} else {
|
||||
setDemodBuf(data, dataLen, 0);
|
||||
setDemodBuff(data, dataLen, 0);
|
||||
}
|
||||
if (clk == 0) clk = 64;
|
||||
if (encoding == 0) clk /= 2; //askraw needs to double the clock speed
|
||||
|
@ -704,7 +704,7 @@ int CmdLFpskSim(const char *Cmd) {
|
|||
PrintAndLogEx(NORMAL, "carrier: %d", carrier);
|
||||
|
||||
} else {
|
||||
setDemodBuf(data, dataLen, 0);
|
||||
setDemodBuff(data, dataLen, 0);
|
||||
}
|
||||
|
||||
if (clk == 0) clk = 32;
|
||||
|
|
|
@ -267,7 +267,7 @@ int CmdAWIDDemod(const char *Cmd) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
setDemodBuf(bits, size, idx);
|
||||
setDemodBuff(bits, size, idx);
|
||||
setClockGrid(50, waveIdx + (idx * 50));
|
||||
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ int CmdCOTAGDemod(const char *Cmd) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
setDemodBuf(bits, bitlen, 0);
|
||||
setDemodBuff(bits, bitlen, 0);
|
||||
|
||||
//got a good demod
|
||||
uint16_t cn = bytebits_to_byteLSBF(bits + 1, 16);
|
||||
|
|
|
@ -356,7 +356,7 @@ int AskEm410xDecode(bool verbose, uint32_t *hi, uint64_t *lo) {
|
|||
size_t idx = 0;
|
||||
uint8_t bits[512] = {0};
|
||||
size_t size = sizeof(bits);
|
||||
if (!getDemodBuf(bits, &size)) {
|
||||
if (!getDemodBuff(bits, &size)) {
|
||||
PrintAndLogEx(DEBUG, "DEBUG: Error - Em410x problem during copy from ASK demod");
|
||||
return 0;
|
||||
}
|
||||
|
@ -381,7 +381,7 @@ int AskEm410xDecode(bool verbose, uint32_t *hi, uint64_t *lo) {
|
|||
}
|
||||
|
||||
//set GraphBuffer for clone or sim command
|
||||
setDemodBuf(DemodBuffer, (size == 40) ? 64 : 128, idx + 1);
|
||||
setDemodBuff(DemodBuffer, (size == 40) ? 64 : 128, idx + 1);
|
||||
setClockGrid(g_DemodClock, g_DemodStartIdx + ((idx + 1)*g_DemodClock));
|
||||
|
||||
PrintAndLogEx(DEBUG, "DEBUG: Em410x idx: %d, Len: %d, Printing Demod Buffer:", idx, size);
|
||||
|
@ -1109,7 +1109,7 @@ bool setDemodBufferEM(uint32_t *word, size_t idx) {
|
|||
PrintAndLogEx(DEBUG, "DEBUG: Error - EM, failed removing parity");
|
||||
return false;
|
||||
}
|
||||
setDemodBuf(DemodBuffer, 32, 0);
|
||||
setDemodBuff(DemodBuffer, 32, 0);
|
||||
*word = bytebits_to_byteLSBF(DemodBuffer, 32);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -186,7 +186,7 @@ int CmdFDXBdemodBI(const char *Cmd) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
setDemodBuf(bs, 128, preambleIndex);
|
||||
setDemodBuff(bs, 128, preambleIndex);
|
||||
|
||||
// remove marker bits (1's every 9th digit after preamble) (pType = 2)
|
||||
size = removeParity(bs, preambleIndex + 11, 9, 2, 117);
|
||||
|
@ -256,7 +256,7 @@ int CmdFdxDemod(const char *Cmd) {
|
|||
}
|
||||
|
||||
// set and leave DemodBuffer intact
|
||||
setDemodBuf(DemodBuffer, 128, preambleIndex);
|
||||
setDemodBuff(DemodBuffer, 128, preambleIndex);
|
||||
setClockGrid(g_DemodClock, g_DemodStartIdx + (preambleIndex * g_DemodClock));
|
||||
// remove marker bits (1's every 9th digit after preamble) (pType = 2)
|
||||
size = removeParity(DemodBuffer, 11, 9, 2, 117);
|
||||
|
|
|
@ -220,7 +220,7 @@ int CmdGuardDemod(const char *Cmd) {
|
|||
PrintAndLogEx(DEBUG, "DEBUG: gProxII byte %u after xor: %02x", (unsigned int)idx, ByteStream[idx]);
|
||||
}
|
||||
|
||||
setDemodBuf(DemodBuffer, 96, preambleIndex);
|
||||
setDemodBuff(DemodBuffer, 96, preambleIndex);
|
||||
setClockGrid(g_DemodClock, g_DemodStartIdx + (preambleIndex * g_DemodClock));
|
||||
|
||||
//ByteStream contains 8 Bytes (64 bits) of decrypted raw tag data
|
||||
|
|
|
@ -155,7 +155,7 @@ int CmdHIDDemod(const char *Cmd) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
setDemodBuf(bits, size, idx);
|
||||
setDemodBuff(bits, size, idx);
|
||||
setClockGrid(50, waveIdx + (idx * 50));
|
||||
|
||||
if (hi2 == 0 && hi == 0 && lo == 0) {
|
||||
|
|
|
@ -208,7 +208,7 @@ int CmdIndalaDemod(const char *Cmd) {
|
|||
PrintAndLogEx(DEBUG, "DEBUG: Error - Indala: error demoding psk idx: %d", idx);
|
||||
return 0;
|
||||
}
|
||||
setDemodBuf(DemodBuffer, size, idx);
|
||||
setDemodBuff(DemodBuffer, size, idx);
|
||||
setClockGrid(g_DemodClock, g_DemodStartIdx + (idx * g_DemodClock));
|
||||
|
||||
//convert UID to HEX
|
||||
|
|
|
@ -112,7 +112,7 @@ int CmdIOProxDemod(const char *Cmd) {
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
setDemodBuf(bits, size, idx);
|
||||
setDemodBuff(bits, size, idx);
|
||||
setClockGrid(64, waveIdx + (idx * 64));
|
||||
|
||||
if (idx == 0) {
|
||||
|
|
|
@ -117,7 +117,7 @@ int CmdJablotronDemod(const char *Cmd) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
setDemodBuf(DemodBuffer, 64, ans);
|
||||
setDemodBuff(DemodBuffer, 64, ans);
|
||||
setClockGrid(g_DemodClock, g_DemodStartIdx + (ans * g_DemodClock));
|
||||
|
||||
//got a good demod
|
||||
|
|
|
@ -84,7 +84,7 @@ int CmdKeriDemod(const char *Cmd) {
|
|||
|
||||
return 0;
|
||||
}
|
||||
setDemodBuf(DemodBuffer, size, idx);
|
||||
setDemodBuff(DemodBuffer, size, idx);
|
||||
setClockGrid(g_DemodClock, g_DemodStartIdx + (idx * g_DemodClock));
|
||||
|
||||
//got a good demod
|
||||
|
|
|
@ -165,7 +165,7 @@ int CmdLFNedapDemod(const char *Cmd) {
|
|||
raw[1] = bytebits_to_byte(DemodBuffer + idx + 64, 32);
|
||||
raw[2] = bytebits_to_byte(DemodBuffer + idx + 32, 32);
|
||||
raw[3] = bytebits_to_byte(DemodBuffer + idx, 32);
|
||||
setDemodBuf(DemodBuffer, 128, idx);
|
||||
setDemodBuff(DemodBuffer, 128, idx);
|
||||
setClockGrid(g_DemodClock, g_DemodStartIdx + (idx * g_DemodClock));
|
||||
|
||||
uint8_t firstParity = GetParity(DemodBuffer, EVEN, 63);
|
||||
|
|
|
@ -57,7 +57,7 @@ int CmdNexWatchDemod(const char *Cmd) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
setDemodBuf(DemodBuffer, size, idx + 4);
|
||||
setDemodBuff(DemodBuffer, size, idx + 4);
|
||||
setClockGrid(g_DemodClock, g_DemodStartIdx + ((idx + 4)*g_DemodClock));
|
||||
|
||||
idx = 8 + 32; // 8 = preamble, 32 = reserved bits (always 0)
|
||||
|
|
|
@ -128,7 +128,7 @@ int CmdNoralsyDemod(const char *Cmd) {
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
setDemodBuf(DemodBuffer, 96, ans);
|
||||
setDemodBuff(DemodBuffer, 96, ans);
|
||||
setClockGrid(g_DemodClock, g_DemodStartIdx + (ans * g_DemodClock));
|
||||
|
||||
//got a good demod
|
||||
|
|
|
@ -46,7 +46,7 @@ int CmdPacDemod(const char *Cmd) {
|
|||
|
||||
return 0;
|
||||
}
|
||||
setDemodBuf(DemodBuffer, 128, ans);
|
||||
setDemodBuff(DemodBuffer, 128, ans);
|
||||
setClockGrid(g_DemodClock, g_DemodStartIdx + (ans * g_DemodClock));
|
||||
|
||||
//got a good demod
|
||||
|
|
|
@ -108,7 +108,7 @@ int CmdParadoxDemod(const char *Cmd) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
setDemodBuf(bits, size, idx);
|
||||
setDemodBuff(bits, size, idx);
|
||||
setClockGrid(50, waveIdx + (idx * 50));
|
||||
|
||||
if (hi2 == 0 && hi == 0 && lo == 0) {
|
||||
|
|
|
@ -144,7 +144,7 @@ int CmdPrescoDemod(const char *Cmd) {
|
|||
PrintAndLogEx(DEBUG, "DEBUG: Error - Presco: ans: %d", ans);
|
||||
return 0;
|
||||
}
|
||||
setDemodBuf(DemodBuffer, 128, ans);
|
||||
setDemodBuff(DemodBuffer, 128, ans);
|
||||
setClockGrid(g_DemodClock, g_DemodStartIdx + (ans * g_DemodClock));
|
||||
|
||||
//got a good demod
|
||||
|
|
|
@ -131,7 +131,7 @@ int CmdPyramidDemod(const char *Cmd) {
|
|||
PrintAndLogEx(DEBUG, "DEBUG: Error - Pyramid: error demoding fsk idx: %d", idx);
|
||||
return 0;
|
||||
}
|
||||
setDemodBuf(bits, size, idx);
|
||||
setDemodBuff(bits, size, idx);
|
||||
setClockGrid(50, waveIdx + (idx * 50));
|
||||
|
||||
// Index map
|
||||
|
|
|
@ -47,7 +47,7 @@ int CmdSecurakeyDemod(const char *Cmd) {
|
|||
PrintAndLogEx(DEBUG, "DEBUG: Error - Securakey: ans: %d", ans);
|
||||
return 0;
|
||||
}
|
||||
setDemodBuf(DemodBuffer, 96, ans);
|
||||
setDemodBuff(DemodBuffer, 96, ans);
|
||||
setClockGrid(g_DemodClock, g_DemodStartIdx + (ans * g_DemodClock));
|
||||
|
||||
//got a good demod
|
||||
|
|
|
@ -90,7 +90,7 @@ int CmdVikingDemod(const char *Cmd) {
|
|||
uint8_t checksum = bytebits_to_byte(DemodBuffer + ans + 32 + 24, 8);
|
||||
PrintAndLogEx(SUCCESS, "Viking Tag Found: Card ID %08X, Checksum: %02X", cardid, checksum);
|
||||
PrintAndLogEx(SUCCESS, "Raw: %08X%08X", raw1, raw2);
|
||||
setDemodBuf(DemodBuffer, 64, ans);
|
||||
setDemodBuff(DemodBuffer, 64, ans);
|
||||
setClockGrid(g_DemodClock, g_DemodStartIdx + (ans * g_DemodClock));
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -122,7 +122,7 @@ int CmdVisa2kDemod(const char *Cmd) {
|
|||
save_restoreGB(GRAPH_RESTORE);
|
||||
return 0;
|
||||
}
|
||||
setDemodBuf(DemodBuffer, 96, ans);
|
||||
setDemodBuff(DemodBuffer, 96, ans);
|
||||
setClockGrid(g_DemodClock, g_DemodStartIdx + (ans * g_DemodClock));
|
||||
|
||||
//got a good demod
|
||||
|
|
|
@ -59,8 +59,8 @@ void save_restoreGB(uint8_t saveOpt) {
|
|||
return;
|
||||
}
|
||||
|
||||
void setGraphBuf(uint8_t *buf, size_t size) {
|
||||
if (buf == NULL) return;
|
||||
void setGraphBuf(uint8_t *buff, size_t size) {
|
||||
if (buff == NULL) return;
|
||||
|
||||
ClearGraph(false);
|
||||
|
||||
|
@ -68,21 +68,21 @@ void setGraphBuf(uint8_t *buf, size_t size) {
|
|||
size = MAX_GRAPH_TRACE_LEN;
|
||||
|
||||
for (uint32_t i = 0; i < size; ++i)
|
||||
GraphBuffer[i] = buf[i] - 128;
|
||||
GraphBuffer[i] = buff[i] - 128;
|
||||
|
||||
GraphTraceLen = size;
|
||||
RepaintGraphWindow();
|
||||
return;
|
||||
}
|
||||
|
||||
size_t getFromGraphBuf(uint8_t *buf) {
|
||||
if (buf == NULL) return 0;
|
||||
size_t getFromGraphBuf(uint8_t *buff) {
|
||||
if (buff == NULL) return 0;
|
||||
uint32_t i;
|
||||
for (i = 0; i < GraphTraceLen; ++i) {
|
||||
//trim
|
||||
if (GraphBuffer[i] > 127) GraphBuffer[i] = 127;
|
||||
if (GraphBuffer[i] < -127) GraphBuffer[i] = -127;
|
||||
buf[i] = (uint8_t)(GraphBuffer[i] + 128);
|
||||
buff[i] = (uint8_t)(GraphBuffer[i] + 128);
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ typedef enum {
|
|||
void SetSIMDInstr(SIMDExecInstr instr);
|
||||
SIMDExecInstr GetSIMDInstrAuto();
|
||||
|
||||
const uint64_t crack_states_bitsliced(uint32_t cuid, uint8_t *best_first_bytes, statelist_t *p, uint32_t *keys_found, uint64_t *num_keys_tested, uint32_t nonces_to_bruteforce, uint8_t *bf_test_nonces_2nd_byte, noncelist_t *nonces);
|
||||
void bitslice_test_nonces(uint32_t nonces_to_bruteforce, uint32_t *bf_test_nonces, uint8_t *bf_test_nonce_par);
|
||||
const uint64_t crack_states_bitsliced(uint32_t cuid, uint8_t *best_first_bytes, statelist_t *p, uint32_t *keys_found, uint64_t *num_keys_tested, uint32_t nonces_to_bruteforce, uint8_t *bf_test_nonce_2nd_byte, noncelist_t *nonces);
|
||||
void bitslice_test_nonces(uint32_t nonces_to_bruteforce, uint32_t *bf_test_nonce, uint8_t *bf_test_nonce_par);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -593,8 +593,8 @@ uint32_t bitcount(uint32_t a) {
|
|||
return (*bitcount_function_p)(a);
|
||||
}
|
||||
|
||||
uint32_t count_states(uint32_t *bitarray) {
|
||||
return (*count_states_function_p)(bitarray);
|
||||
uint32_t count_states(uint32_t *A) {
|
||||
return (*count_states_function_p)(A);
|
||||
}
|
||||
|
||||
void bitarray_AND(uint32_t *A, uint32_t *B) {
|
||||
|
|
|
@ -70,7 +70,7 @@ typedef struct {
|
|||
extern char logHexFileName[FILE_PATH_SIZE];
|
||||
|
||||
int mfDarkside(uint8_t blockno, uint8_t key_type, uint64_t *key);
|
||||
int mfnested(uint8_t blockNo, uint8_t keyType, uint8_t *key, uint8_t trgBlockNo, uint8_t trgKeyType, uint8_t *resultKeys, bool calibrate);
|
||||
int mfnested(uint8_t blockNo, uint8_t keyType, uint8_t *key, uint8_t trgBlockNo, uint8_t trgKeyType, uint8_t *resultKey, bool calibrate);
|
||||
int mfCheckKeys(uint8_t blockNo, uint8_t keyType, bool clear_trace, uint8_t keycnt, uint8_t *keyBlock, uint64_t *key);
|
||||
int mfCheckKeys_fast(uint8_t sectorsCnt, uint8_t firstChunk, uint8_t lastChunk,
|
||||
uint8_t strategy, uint32_t size, uint8_t *keyBlock, sector_t *e_sector, bool use_flashmemory);
|
||||
|
|
|
@ -107,12 +107,12 @@ uint32_t CRC8Mad(uint8_t *buff, size_t size) {
|
|||
return crc_finish(&crc);
|
||||
}
|
||||
// width=4 poly=0xC, reversed poly=0x7 init=0x5 refin=true refout=true xorout=0x0000 check= name="CRC-4/LEGIC"
|
||||
uint32_t CRC4Legic(uint8_t *cmd, size_t size) {
|
||||
uint32_t CRC4Legic(uint8_t *buff, size_t size) {
|
||||
crc_t crc;
|
||||
crc_init_ref(&crc, 4, 0x19 >> 1, 0x5, 0, true, true);
|
||||
crc_update2(&crc, 1, 1); /* CMD_READ */
|
||||
crc_update2(&crc, cmd[0], 8);
|
||||
crc_update2(&crc, cmd[1], 8);
|
||||
crc_update2(&crc, buff[0], 8);
|
||||
crc_update2(&crc, buff[1], 8);
|
||||
return reflect(crc_finish(&crc), 4);
|
||||
}
|
||||
// width=8 poly=0x63, reversed poly=0x8D init=0x55 refin=true refout=true xorout=0x0000 check=0xC6 name="CRC-8/LEGIC"
|
||||
|
|
|
@ -9,21 +9,21 @@
|
|||
|
||||
static uint16_t crc_table[256];
|
||||
static bool crc_table_init = false;
|
||||
static CrcType_t crc_type = CRC_NONE;
|
||||
static CrcType_t current_crc_type = CRC_NONE;
|
||||
|
||||
void init_table(CrcType_t ct) {
|
||||
void init_table(CrcType_t crctype) {
|
||||
|
||||
// same crc algo, and initialised already
|
||||
if (ct == crc_type && crc_table_init)
|
||||
if (crctype == current_crc_type && crc_table_init)
|
||||
return;
|
||||
|
||||
// not the same crc algo. reset table.
|
||||
if (ct != crc_type)
|
||||
if (crctype != current_crc_type)
|
||||
reset_table();
|
||||
|
||||
crc_type = ct;
|
||||
current_crc_type = crctype;
|
||||
|
||||
switch (ct) {
|
||||
switch (crctype) {
|
||||
case CRC_14443_A:
|
||||
case CRC_14443_B:
|
||||
case CRC_15693:
|
||||
|
@ -44,7 +44,7 @@ void init_table(CrcType_t ct) {
|
|||
break;
|
||||
default:
|
||||
crc_table_init = false;
|
||||
crc_type = CRC_NONE;
|
||||
current_crc_type = CRC_NONE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ void generate_table(uint16_t polynomial, bool refin) {
|
|||
void reset_table(void) {
|
||||
memset(crc_table, 0, sizeof(crc_table));
|
||||
crc_table_init = false;
|
||||
crc_type = CRC_NONE;
|
||||
current_crc_type = CRC_NONE;
|
||||
}
|
||||
|
||||
// table lookup LUT solution
|
||||
|
|
|
@ -32,7 +32,7 @@ typedef enum {
|
|||
|
||||
uint16_t update_crc16_ex(uint16_t crc, uint8_t c, uint16_t polynomial);
|
||||
uint16_t update_crc16(uint16_t crc, uint8_t c);
|
||||
uint16_t crc16(uint8_t const *message, size_t length, uint16_t remainder, uint16_t polynomial, bool refin, bool refout);
|
||||
uint16_t crc16(uint8_t const *d, size_t length, uint16_t remainder, uint16_t polynomial, bool refin, bool refout);
|
||||
|
||||
uint16_t crc(CrcType_t ct, const uint8_t *d, size_t n);
|
||||
void compute_crc(CrcType_t ct, const uint8_t *d, size_t n, uint8_t *first, uint8_t *second);
|
||||
|
|
Loading…
Reference in a new issue