This commit is contained in:
iceman1001 2019-04-16 16:07:25 +02:00
parent f50566225c
commit c6aa14efb7

View file

@ -222,10 +222,7 @@ static uint16_t calcBSDchecksum4(uint8_t *bytes, uint8_t len, uint32_t mask) {
// measuring LFSR maximum length
static int CmdAnalyseLfsr(const char *Cmd) {
uint16_t start_state = 0; /* Any nonzero start state will work. */
uint16_t lfsr = start_state;
//uint32_t period = 0;
uint16_t lfsr, start_state = 0; /* Any nonzero start state will work. */
uint8_t iv = param_get8ex(Cmd, 0, 0, 16);
uint8_t find = param_get8ex(Cmd, 1, 0, 16);
@ -233,11 +230,9 @@ static int CmdAnalyseLfsr(const char *Cmd) {
PrintAndLogEx(NORMAL, " bit# | lfsr | ^0x40 | 0x%02X ^ lfsr \n", find);
for (uint8_t i = 0x01; i < 0x30; i += 1) {
//period = 0;
legic_prng_init(iv);
legic_prng_forward(i);
lfsr = legic_prng_get_bits(12);
PrintAndLogEx(NORMAL, " %02X | %03X | %03X | %03X \n", i, lfsr, 0x40 ^ lfsr, find ^ lfsr);
}
return 0;