From 9dd6e4a85f8c30ad133c651691afa38385e6395e Mon Sep 17 00:00:00 2001 From: Andy Shieh Date: Sun, 27 Jul 2025 21:31:42 +1000 Subject: [PATCH 1/3] Fix getIndalaBits checksum logic Signed-off-by: Andy Shieh --- client/src/cmdlfindala.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/client/src/cmdlfindala.c b/client/src/cmdlfindala.c index 53cd2647a..01de546c0 100644 --- a/client/src/cmdlfindala.c +++ b/client/src/cmdlfindala.c @@ -1163,21 +1163,14 @@ 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) { - bits[62] = 0; - bits[63] = 1; - } else { + if ((chk % 2) == 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. + bits[62] = 0; + bits[63] = 1; } - // add parity - // bits[34] = 1; // p1 64 - 30 = 34 - // bits[38] = 1; // p2 68 - 30 = 38 - - // 92 = 62 - // 93 = 63 - bits[34] = 0; // parity for odd bits bits[38] = 0; // parity for even bits uint8_t p1 = 1; From 9ce90315163b5bf2e49f7b5cbcf7e53ed971b4d1 Mon Sep 17 00:00:00 2001 From: Andy Shieh Date: Sun, 27 Jul 2025 21:39:09 +1000 Subject: [PATCH 2/3] Update CHANGELOG.md Signed-off-by: Andy Shieh --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f71c9634f..4e6c7c13c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ This project uses the changelog in accordance with [keepchangelog](http://keepac - Changed `hf mfu sim` - now support UL-C simulation (@iceman1001) - Added `!` - run system commands from inside the client. Potentially dangerous if running client as SUDO, SU, ROOT (@iceman1001) - Implemented `hf felica scsvcode` - now dumps all service and area codes. (@zinongli) +- Fixed `lf indala cone` - now writing the right bits when using `--fc` and `--cn` ## [Daddy Iceman.4.20469][2025-06-16] - Fixed edge case in fm11rf08s key recovery tools (@doegox) From 7e7fe1837ee7b24e707ba247e8f72b7a7110ba9b Mon Sep 17 00:00:00 2001 From: Andy Shieh Date: Mon, 28 Jul 2025 22:41:18 +1000 Subject: [PATCH 3/3] [Fix] added original comments back; use same bitwise operation for even check Signed-off-by: Andy Shieh --- client/src/cmdlfindala.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/client/src/cmdlfindala.c b/client/src/cmdlfindala.c index 01de546c0..c42f0ddf1 100644 --- a/client/src/cmdlfindala.c +++ b/client/src/cmdlfindala.c @@ -1163,14 +1163,21 @@ 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 % 2) == 0) { // If the sum is even, checksum is '10' (binary) = 2. + 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. bits[62] = 0; bits[63] = 1; } + + // add parity + // bits[34] = 1; // p1 64 - 30 = 34 + // bits[38] = 1; // p2 68 - 30 = 38 + // 92 = 62 + // 93 = 63 + bits[34] = 0; // parity for odd bits bits[38] = 0; // parity for even bits uint8_t p1 = 1;