commonutil: pack / unpack ISO14443-A air order bits with parity

A HID SAM driving MIFARE Classic hands over Crypto1 frames as one bit
stream: each byte's 8 data bits LSB first followed by its parity bit.
These convert between that stream and the bytes plus parity array the
PM3 reader and trace code use. Shared so the client can self test them.

Cross checked against a port of Seader's plugin_hf_mfc_transmit for
frames up to 8 bytes (its limit) and for 4 and 18 byte answers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
iceman1001andClaude Opus 5.5 committed 2026-11-10 10:23:39 +07:00
1 parent 8d2a419319
commit 6100a46f12
2 files changed
+44

No files matched your search

+3
View File
@@ -161,4 +161,7 @@ void reverse_arraybytes_copy(const uint8_t *arr, uint8_t *dest, size_t len);
size_t concatbits(uint8_t *dest, int dest_offset, const uint8_t *src, int src_offset, size_t nbits, bool src_lsb);
int char2int(char c);
int hexstr2ByteArr(const char *hexstr, unsigned char *array, size_t asize);
uint16_t iso14a_air_bits_pack(const uint8_t *data, const uint8_t *par, uint16_t n, uint8_t *out);
uint16_t iso14a_air_bits_unpack(const uint8_t *in, uint16_t in_len, uint8_t *data, uint8_t *par);
#endif