mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-19 21:03:48 -07:00
lf t55xx chk m - tweaking the algo
This commit is contained in:
parent
4a09a1e17f
commit
dc6e4ea4ea
1 changed files with 8 additions and 2 deletions
|
@ -2074,7 +2074,7 @@ void T55xx_ChkPwds(uint8_t flags) {
|
||||||
b1 = 0;
|
b1 = 0;
|
||||||
T55xxReadBlock(0, 0, true, 0, 0, downlink_mode);
|
T55xxReadBlock(0, 0, true, 0, 0, downlink_mode);
|
||||||
for (uint16_t j = 0; j < CHK_SAMPLES_SIGNAL; ++j) {
|
for (uint16_t j = 0; j < CHK_SAMPLES_SIGNAL; ++j) {
|
||||||
b1 += buf[j];
|
b1 += (buf[j] * buf[j]);
|
||||||
}
|
}
|
||||||
b1 *= b1;
|
b1 *= b1;
|
||||||
b1 >>= 8;
|
b1 >>= 8;
|
||||||
|
@ -2082,6 +2082,9 @@ void T55xx_ChkPwds(uint8_t flags) {
|
||||||
}
|
}
|
||||||
baseline_faulty >>= 5;
|
baseline_faulty >>= 5;
|
||||||
|
|
||||||
|
if (DBGLEVEL >= DBG_DEBUG)
|
||||||
|
Dbprintf("Baseline " _YELLOW_("%llu"), baseline_faulty);
|
||||||
|
|
||||||
uint8_t *pwds = BigBuf_get_EM_addr();
|
uint8_t *pwds = BigBuf_get_EM_addr();
|
||||||
uint16_t pwd_count = 0;
|
uint16_t pwd_count = 0;
|
||||||
|
|
||||||
|
@ -2133,7 +2136,7 @@ void T55xx_ChkPwds(uint8_t flags) {
|
||||||
|
|
||||||
uint64_t sum = 0;
|
uint64_t sum = 0;
|
||||||
for (uint16_t j = 0; j < CHK_SAMPLES_SIGNAL; ++j) {
|
for (uint16_t j = 0; j < CHK_SAMPLES_SIGNAL; ++j) {
|
||||||
sum += buf[j];
|
sum += (buf[j] * buf[j]);
|
||||||
}
|
}
|
||||||
sum *= sum;
|
sum *= sum;
|
||||||
sum >>= 8;
|
sum >>= 8;
|
||||||
|
@ -2141,6 +2144,9 @@ void T55xx_ChkPwds(uint8_t flags) {
|
||||||
int64_t tmp_dist = (baseline_faulty - sum);
|
int64_t tmp_dist = (baseline_faulty - sum);
|
||||||
curr = ABS(tmp_dist);
|
curr = ABS(tmp_dist);
|
||||||
|
|
||||||
|
if (DBGLEVEL >= DBG_DEBUG)
|
||||||
|
Dbprintf("%08x has distance " _YELLOW_("%llu"), pwd, curr);
|
||||||
|
|
||||||
if (curr > prev) {
|
if (curr > prev) {
|
||||||
idx = i;
|
idx = i;
|
||||||
prev = curr;
|
prev = curr;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue