2023-09-18 08:00:09 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
2023-09-25 07:16:26 +00:00
|
|
|
enum mifare_cmd {
|
|
|
|
MIFARE_CMD_AUTH_KEY_A = 0x60,
|
|
|
|
MIFARE_CMD_AUTH_KEY_B = 0x61,
|
|
|
|
MIFARE_CMD_PERSONALIZE_UID = 0x40,
|
|
|
|
MIFARE_CMD_SET_MOD_TYPE = 0x43,
|
|
|
|
MIFARE_CMD_READ = 0x30,
|
|
|
|
MIFARE_CMD_WRITE = 0xA0,
|
|
|
|
MIFARE_CMD_DECREMENT = 0xC0,
|
|
|
|
MIFARE_CMD_INCREMENT = 0xC1,
|
|
|
|
MIFARE_CMD_RESTORE = 0xC2,
|
|
|
|
MIFARE_CMD_TRANSFER = 0xB0,
|
|
|
|
};
|
|
|
|
|
2023-09-18 08:00:09 +00:00
|
|
|
struct mifare_block {
|
|
|
|
uint8_t bytes[16];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct mifare_sector {
|
|
|
|
struct mifare_block blocks[4];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct mifare {
|
|
|
|
struct mifare_sector sectors[16];
|
|
|
|
};
|