What is the net memory space remaining in a MIFARE Classic 1K card considering that keys and access bits take 16 bytes per sector, and the unique id (UID) and manufacturer data takes 16 bytes for each card?
-
really no one ? at least guide me where to find the answer ! – Faris Oct 14 '14 at 02:03
1 Answers
MIFARE Classic 1K consists of 16 sectors. One sector consists of 4 blocks (sector trailer + 3 data blocks). Each block consists of 16 bytes.
This gives 16 Sectors * 4 Blocks * 16 Bytes = 1024 Bytes
.
The actually usable data area depends on how you want to use the card:
You use only one key per sector (key A); you use the unused parts of the sector trailers for data storage; you don't use a MIFARE application directory (MAD):
- The first block of the first sector is always reserved (UID/manufacturer data) and cannot be used to store user data.
- 6 bytes of each sector trailer are reserved for key A. 3 bytes of each sector trailer are reserved for the access conditions. The remaining 7 bytes of the sector trailer can be used to store user data.
Thus, you can store
1 Sector * (2 Blocks * 16 Bytes + 1 Block * 7 Bytes) + 15 Blocks * (3 Blocks * 16 Bytes + 1 Block * 7 Bytes) = 864 Bytes
.You use two keys per sector (key A and key B); you use the unused parts of the sector trailers for data storage; you don't use a MIFARE application directory (MAD):
- 12 bytes of each sector trailer are reserved for key A and B. 3 bytes of each sector trailer are reserved for the access conditions. The remaining byte of the sector trailer can be used to store user data.
Thus, you can store
1 Sector * (2 Blocks * 16 Bytes + 1 Block * 1 Byte) + 15 Blocks * (3 Blocks * 16 Bytes + 1 Block * 1 Byte) = 768 Bytes
.You use two keys per sector (key A and key B); you don't use the unused parts of the sector trailers for data storage; you don't use a MIFARE application directory (MAD):
Thus, you can store
1 Sector * 2 Blocks * 16 Bytes + 15 Blocks * 3 Blocks * 16 Bytes = 752 Bytes
.You use two keys per sector (key A and key B); you use the unused parts of the sector trailers for data storage; you use a MIFARE application directory (MAD):
- The data blocks and the general purpose byte (remaining byte in the sector trailer) of the first sector are reserved for the MAD.
- The general purpose byte in the other sectors can be used.
Thus, you can store
15 Blocks * (3 Blocks * 16 Bytes + 1 Block * 1 Byte) = 735 Bytes
.You use two keys per sector (key A and key B); you use NXP's NDEF data mapping to transport an NDEF message:
- The MAD is used to assign sectors to the NDEF application.
- NDEF data can only be stored in the 3 data blocks of each NDEF sector.
- The NDEF message is wrapped in an NDEF TLV structure (1 byte for the tag 0x03, three bytes to indicate a length of more than 254 bytes).
Thus, you can store an NDEF message of up to
15 Blocks * 3 Blocks * 16 Bytes - 4 bytes = 716 Bytes
. Such an NDEF message could have a maximum payload of716 Bytes - 1 Byte - 1 Byte - 4 Bytes = 710 Bytes
(when using a NDEF record with TNF unknown, 1 header byte, 1 type length byte, 4 payload length bytes).

- 39,663
- 10
- 99
- 206