lf indala: --fc/--cn parity and checksum as on genuine cards
PR #2453 computed the parity bits over stream positions and PR #2947 inverted the checksum, so --fc/--cn clones did not match the genuine cards on record, from issue #2939 and the DangerousThings forum. Both carry the 26-bit Wiegand parity of getIndalaBits4041x and the checksum from before #2947, and the encoder now reproduces them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f90d0d0bf9
commit
451ce54bed
2 files changed
+9
-18
No files matched your search
@@ -3,6 +3,7 @@ All notable changes to this project will be documented in this file.
|
||||
This project uses the changelog in accordance with [keepchangelog](http://keepachangelog.com/). Please use this to write notable changes, which is not the same as git commit log...
|
||||
|
||||
## [unreleased][unreleased]
|
||||
- Fixed `lf indala clone`, `sim` and `brute` with `--fc`/`--cn` - parity and checksum bits as on genuine cards (@matrix)
|
||||
- Fixed flashing with redirected output - the progress animation is drawn only when stdout is a terminal (@matrix)
|
||||
- Fixed `proxmark3 --flash`, `--dumpmem` and `--reboot-to-bootloader` exit status - a failure exits 1, a failed flash no longer ends with `All done` (@matrix)
|
||||
- Fixed `data rawdemod` - `--max`, `--samples` and the `--p2` clock no longer wrap above 255, `--fs` refuses values above 255 (@matrix)
|
||||
|
||||
@@ -1163,12 +1163,13 @@ int getIndalaBits(uint8_t fc, uint16_t cn, uint8_t *bits) {
|
||||
chk += ((cn >> 2) & 1); //y14 == 89 - 30 = 59
|
||||
chk += (cn & 1); //y16 == 71 - 30 = 41
|
||||
|
||||
if ((chk & 1) == 0) { // If the sum is even, checksum is '10' (binary) = 2.
|
||||
bits[62] = 1;
|
||||
bits[63] = 0;
|
||||
} else { // If the sum is odd, checksum is '01' (binary) = 1.
|
||||
// as on genuine cards, see issue #2939
|
||||
if ((chk & 1) == 0) { // If the sum is even, checksum is '01' (binary) = 1.
|
||||
bits[62] = 0;
|
||||
bits[63] = 1;
|
||||
} else { // If the sum is odd, checksum is '10' (binary) = 2.
|
||||
bits[62] = 1;
|
||||
bits[63] = 0;
|
||||
}
|
||||
|
||||
// add parity
|
||||
@@ -1178,20 +1179,9 @@ int getIndalaBits(uint8_t fc, uint16_t cn, uint8_t *bits) {
|
||||
// 92 = 62
|
||||
// 93 = 63
|
||||
|
||||
bits[34] = 0; // parity for odd bits
|
||||
bits[38] = 0; // parity for even bits
|
||||
uint8_t p1 = 1;
|
||||
uint8_t p2 = 1;
|
||||
|
||||
for (int i = 33; i < 64; i++) {
|
||||
if (i % 2)
|
||||
p1 ^= bits[i];
|
||||
else
|
||||
p2 ^= bits[i];
|
||||
}
|
||||
|
||||
bits[34] = p1; // parity for odd bits
|
||||
bits[38] = p2; // parity for even bits
|
||||
// 26-bit wiegand parity, as in getIndalaBits4041x
|
||||
bits[34] = evenparity16((fc << 4) | (cn >> 12));
|
||||
bits[38] = oddparity16(cn & 0x0fff);
|
||||
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user