mirror of
https://github.com/Proxmark/proxmark3.git
synced 2025-08-22 06:13:27 -07:00
fixed parity calc and add parity print. works.
This commit is contained in:
parent
a965ed1b13
commit
4c1327a90e
3 changed files with 7 additions and 3 deletions
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
|
||||
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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue