diff --git a/client/src/cmdlfindala.c b/client/src/cmdlfindala.c index 0b5c7bd0a..d0c9557d9 100644 --- a/client/src/cmdlfindala.c +++ b/client/src/cmdlfindala.c @@ -1164,11 +1164,26 @@ int getIndalaBits(uint8_t fc, uint16_t cn, uint8_t *bits) { } // add parity - bits[34] = 1; // p1 64 - 30 = 34 - bits[38] = 1; // p2 68 - 30 = 38 + // 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; + 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 return PM3_SUCCESS; }