Free MIFARE MAD1 & MAD2 AID & CRC-8 Calculator

Build or decode NXP AN10787 MIFARE Application Directory blocks for MAD1 (Sector 00h Blocks 1–2) and MAD2 (Sector 10h Blocks 0–2), pack 2-byte little-endian Application Identifiers (AIDs), set the Info publisher byte and General Purpose Byte (C1h / C2h), and compute or verify CRC-8/MIFARE-MAD. Runs locally in your browser with no key inputs, uploads or storage.

Updated

Mode
Card capacity & MAD version
Quick presets:

00 for none, 01–0F in MAD1, or 01–0F / 11–27 in MAD2 (10h is forbidden because Sector 10h holds MAD2).

e.g. E103 NDEF, 4801 Access, 6001 Canteen

0–38 sectors

e.g. 6001 Canteen, 5801 Campus, 7501 Parking

0–38 sectors

e.g. 0004 Cardholder ASCII, 0001 Defective

0–38 sectors

MAD directory blocks, CRC-8 & sector map

1K — MAD1 (15 app sectors): 15 allocated sector(s) (720 B), 0 free (0 B) · Sector 00h CRC = 0x14, GPB = 0xC1.

Sector 00h Block 1 Byte 0–1 (CRC-8 + Info)

0x14 · Info 0x01

Sector 00h Trailer Byte 9 (GPB)

0xC1 (MAD1, Multi-app)

Sector 00h Block 1 (Byte 0 CRC, Byte 1 Info, Sectors 01h–07h LE)

14 01 03 E1 03 E1 03 E1 03 E1 03 E1 03 E1 03 E1

Sector 00h Block 2 (Sectors 08h–0Fh LE)

03 E1 03 E1 03 E1 03 E1 03 E1 03 E1 03 E1 03 E1

Sector 00h Block 3 Trailer (A0 A1 A2 A3 A4 A5 + Access + GPB; replace FF..FF with Key B)

A0 A1 A2 A3 A4 A5 78 77 88 C1 FF FF FF FF FF FF

Logical AID Stored LE Sectors User bytes AN10787 cluster / role
E103h 03 E1 01h–0Fh (1–15) (15) 720 B NFC Forum NDEF application (AN1304 / AN1305)
Full sector-by-sector directory slot map
Sector Directory AID Bytes Payload & cluster
Loading sector map…

Ordering pre-initialised multi-application cards, fobs or wristbands?

Proud Tek manufactures genuine NXP MIFARE Classic EV1 1K, 4K, MIFARE Plus EV2 and MIFARE DESFire EV3 cards, key fobs and wristbands in Shenzhen — shipped blank or pre-encoded via our RFID encoding service, with 100% post-encode read-back and an Excel, CSV or XML UID-to-number list.

Standard blank samples are free; custom-printed or pre-encoded samples carry a setup fee, confirmed in the quotation. Never send secret Key B values in an inquiry form.

How NXP AN10787 structures MAD1 (Sector 00h) and MAD2 (Sector 10h)

When a campus, municipality or workplace shares one MIFARE Classic or MIFARE Plus SL1 card across independent readers — doors, canteen tills, print release, library kiosks or bike lockers — hardcoding sector numbers eventually causes collisions. NXP’s MIFARE Application Directory (AN10787) reserves fixed directory sectors readable with the public Key A A0 A1 A2 A3 A4 A5 so any terminal can look up its 2-byte Application Identifier (AID) dynamically:

  • Sector 00h (MAD1 & lower MAD2): Block 0 is the read-only IC manufacturer/UID block. Block 1 Byte 0 holds the 8-bit CRC-8/MIFARE-MAD checksum across the next 31 bytes; Block 1 Byte 1 holds the 6-bit Info pointer to the card publisher’s sector (00h if unused); Block 1 Bytes 2–15 and Block 2 Bytes 0–15 hold fifteen 2-byte little-endian [AppCode, ClusterCode] slots for Sectors 01h–0Fh.
  • Sector 10h / Sector 16 (MAD2 upper directory for cards > 1 KB): Because Sector 16 has no manufacturer block, all three data blocks (Blocks 0, 1 and 2 = 48 bytes) store the upper directory: Block 0 Byte 0 holds the 8-bit CRC over the next 47 bytes, Block 0 Byte 1 holds the Info byte, and the remaining 46 bytes hold twenty-three 2-byte little-endian slots for Sectors 11h–27h (Sectors 17–39).
  • General Purpose Byte (GPB, Sector 00h Block 3 Byte 9): Bit 7 (DA = 1) declares that a MAD is present; Bit 6 (MA) marks multi-application (1) vs mono-application (0); Bits 5..2 are reserved 0000b; Bits 1..0 (ADV) select 01b for MAD1 (C1h / 81h) or 10b for MAD2 (C2h / 82h). Sector 10h’s trailer GPB is reserved 00h.

Standard MAD presets & reference checksums

Preset MAD / GPB Sector 00h CRC Block 1 first 6 bytes Notes
NFC Forum NDEF 1K (E103h × 15) MAD1 · C1h 0x14 14 01 03 E1 03 E1 NXP AN1305 MIFARE Classic 1K NDEF tag: Info = 01h, all 15 sectors assigned to E103h (stored 03 E1), CRC = 14h, GPB = C1h.
Campus 4K Multi-App (MAD2) MAD2 · C2h 0xDC DC 01 01 48 01 48 4K card with MAD2 (GPB = C2h): 4 access sectors (4801h), 4 canteen sectors (6001h), 1 cardholder ASCII sector (0004h) and 29 free sectors.
MIFARE Plus 2K (MAD2 + 0005h pad) MAD2 · C2h 0x15 15 01 01 48 01 48 32-sector 2K card using MAD2: 15 access sectors (4801h) + 4 NDEF sectors (E103h), with non-existent sectors 20h–27h marked 0005h per AN10787.
Blank Initialised MAD1 (CRC CEh) MAD1 · C1h 0xCE CE 00 00 00 00 00 Pre-formatted empty 1K directory: Info = 00h, all 15 application sectors free (0000h), CRC = CEh, public Key A = A0..A5.

Four implementation traps in MAD firmware and card personalisation

  1. CRC seed 0xE3 vs 0xC7: AN10787’s hardware shift-register diagram draws bit 0 on the left (1110 0011b = 0xE3). In MSB-first C, Python or TypeScript byte code, initialize crc = 0xC7 (1100 0111b) with polynomial 0x1D and feed bytes from Info onward without feeding the CRC byte itself.
  2. Swapping Cluster and Application bytes: Logical AID 4801h (Cluster 48h access control, App 01h) is stored in memory as 01 48, and NFC Forum NDEF E103h is stored as 03 E1. Reversing the pair makes compliant readers skip your sector.
  3. Leaving Sector 00h trailer in transport mode (FF 07 80): Public Key A (A0 A1 A2 A3 A4 A5) is published in AN10787 so every reader can inspect the directory. Always lock Sector 00h (and Sector 10h on MAD2) with access bytes 78 77 88 (check bit complements in our MIFARE Classic Access Bits Calculator) so only your secret issuer Key B can alter directory pointers.
  4. Mistaking MAD organisation for cryptographic security: Public Key A gives an attacker a known key on Sector 00h immediately, enabling the 2015 hardnested attack against other Crypto-1 sectors on MIFARE Classic EV1. New multi-application estates should use MIFARE DESFire EV3 (which manages isolated 3-byte AIDs natively in hardware under AES-128 — size files in our DESFire Memory Calculator) or MIFARE Plus EV2 in Security Level 3.

Questions about MIFARE MAD1, MAD2 and CRC-8

What is the difference between MAD1 and MAD2 in NXP AN10787?

MAD1 covers cards up to 1 KB (16 sectors, 00h–0Fh, such as MIFARE Classic EV1 1K): Sector 00h Blocks 1 and 2 hold 15 two-byte Application Identifiers (AIDs) for Sectors 01h–0Fh, and Sector 00h Block 3 sets GPB bits 1..0 = 01b (for example C1h). MAD2 covers cards larger than 1 KB (such as MIFARE Plus 2K or MIFARE Classic EV1 4K, up to 40 sectors 00h–27h): it sets Sector 00h GPB bits 1..0 = 10b (for example C2h) and adds a second directory in Sector 10h (Sector 16) Blocks 0, 1 and 2 holding 23 two-byte AIDs for Sectors 11h–27h, giving 15 + 23 = 38 application sectors in total. Per AN10787, an MAD1 reader can still use an MAD2 card without changes, addressing only the lower 1 KB (Sectors 01h–0Fh).

Why does AN10787 show CRC preset 0xE3 while software tools use 0xC7?

Both describe the exact same CRC-8/MIFARE-MAD checksum (polynomial x^8 + x^4 + x^3 + x^2 + 1 = 0x1D). In AN10787’s hardware shift-register diagram, bit 0 is drawn on the left and bit 7 on the right (1110 0011b = 0xE3); when mirrored into a standard MSB-first software byte register (b7..b0), 1110 0011b becomes 1100 0111b = 0xC7. Feeding Info = 01h plus fifteen 03 E1 pairs into crc = 0xC7 yields 0x14 — matching NXP AN1305’s standard NDEF Sector 00h Block 1 dump (14 01 03 E1…).

Why is NFC Forum NDEF AID E103h written as 03 E1 inside the MAD block?

Every 2-byte MAD slot stores the Application Code byte first (little-endian) followed by the Function Cluster Code byte. For NFC Forum NDEF on MIFARE Classic (NXP AN1304 / AN1305), the Function Cluster Code is E1h and the Application Code is 03h (logical AID E103h), so the two bytes written into Sector 00h or Sector 10h are 03 E1.

How do 2K (32-sector) cards use MAD2 when Sector 10h maps 40 sectors?

A 2K card (32 physical sectors, 00h–1Fh) exceeds MAD1’s 16-sector ceiling, so it must use MAD2. Because physical Sectors 20h–27h (32–39) do not exist on a 2K card, NXP AN10787 reserves administration AID 0005h (stored little-endian as 05 00, "sector not applicable — above memory size") for those last eight slots in Sector 10h Block 2.

Does using MAD with secret Key B make MIFARE Classic secure for campus payment or access?

No. Public Key A (A0 A1 A2 A3 A4 A5) intentionally lets any MAD reader read Sector 00h and Sector 10h, while access bytes 78 77 88 require secret Key B to overwrite the directory. However, MIFARE Classic’s underlying Crypto-1 cipher is publicly broken: the 2015 hardnested attack recovers other sector keys from hardened EV1 cards in minutes once any single key on the card — including the public MAD Key A — is known. Use MAD on genuine NXP MIFARE Classic EV1 only when existing readers require it; for new multi-application campus, hotel or transit cards, specify MIFARE Plus in SL3 (AES-128) or MIFARE DESFire EV3.

Sources

Related pages

WhatsApp