diff --git a/client/cmdhfmf.c b/client/cmdhfmf.c index 8435c2c3..0a6e7ca0 100644 --- a/client/cmdhfmf.c +++ b/client/cmdhfmf.c @@ -2599,7 +2599,6 @@ int CmdHF14AMfSniff(const char *Cmd){ } else { oddparitybuf(bufPtr, len, parity); PrintAndLog("%s(%d):%s [%s] c[%s]", isTag ? "TAG":"RDR", num, sprint_hex(bufPtr, len), printBitsPar(bufPtr + len, len), printBitsPar(parity, len)); - PrintAndLog("p:%s %s", sprint_hex(bufPtr + len, parlen), sprint_hex_inrow(parity, parlen)); if (wantLogToFile) AddLogHex(logHexFileName, isTag ? "TAG: ":"RDR: ", bufPtr, len); if (wantDecrypt) diff --git a/client/mifarehost.c b/client/mifarehost.c index 02afe75e..55dac115 100644 --- a/client/mifarehost.c +++ b/client/mifarehost.c @@ -20,6 +20,7 @@ #include "usb_cmd.h" #include "cmdmain.h" #include "ui.h" +#include "parity.h" #include "util.h" #include "iso14443crc.h" @@ -714,7 +715,9 @@ int mfTraceDecode(uint8_t *data_src, int len, bool wantSaveToEmlFile) { memcpy(data, data_src, len); if ((traceCrypto1) && ((traceState == TRACE_IDLE) || (traceState > TRACE_AUTH_OK))) { mf_crypto1_decrypt(traceCrypto1, data, len, 0); - PrintAndLog("dec> %s", sprint_hex(data, len)); + uint8_t parity[16]; + oddparitybuf(data, len, parity); + PrintAndLog("dec> %s [%s]", sprint_hex(data, len), printBitsPar(parity, len)); AddLogHex(logHexFileName, "dec> ", data, len); } diff --git a/common/parity.h b/common/parity.h index 7a257697..90009080 100644 --- a/common/parity.h +++ b/common/parity.h @@ -13,6 +13,7 @@ #include #include +#include extern const uint8_t OddByteParity[256]; @@ -22,8 +23,9 @@ static inline bool oddparity8(const uint8_t x) { } static inline void oddparitybuf(const uint8_t *x, size_t len, uint8_t *parity) { + memset(parity, 0x00, len / 8 + 1); for (int i = 0; i < len; i++) - parity[i / 8] ^= oddparity8(*x >> ((i % 8) * 8) & 0xff) << (i % 8); + parity[i / 8] |= oddparity8(x[i]) << (7 - (i % 8)); } static inline bool evenparity8(const uint8_t x) {