Skip to content

patterns/mifare: Add MIFARE Classic 1K and 4K patterns and test data#498

Open
Bananz0 wants to merge 2 commits intoWerWolv:masterfrom
Bananz0:feature/mifare-classic-patterns
Open

patterns/mifare: Add MIFARE Classic 1K and 4K patterns and test data#498
Bananz0 wants to merge 2 commits intoWerWolv:masterfrom
Bananz0:feature/mifare-classic-patterns

Conversation

@Bananz0
Copy link
Copy Markdown

@Bananz0 Bananz0 commented Feb 18, 2026

Grouped MIFARE Classic patterns into their own folder

Adds:

  • MIFARE Classic 1K and 4K pattern files in patterns/mifare/.
  • Validation logic for block 0 integrity (BCC check) and SAK type identification.
  • Access condition verification for all sector trailers, ensuring nibble-pair complement invariants.
  • Synthetic test binaries for both 1K and 4K formats in tests/patterns/test_data

Copilot AI review requested due to automatic review settings February 18, 2026 23:58
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds comprehensive pattern definitions for MIFARE Classic 1K and 4K NFC cards, implementing ISO/IEC 14443-3 Type A format specifications with detailed validation logic. The patterns are placed in a new patterns/mifare/ directory, following good organization practices for related formats.

Changes:

  • Added MIFARE Classic 1K pattern file with struct definitions for manufacturer block, data blocks, sector trailers, and validation functions for BCC, SAK, and access bits
  • Added MIFARE Classic 4K pattern file supporting both small (64-byte) and large (256-byte) sectors with comprehensive validation
  • Added synthetic test binaries for both 1K (1024 bytes) and 4K (4096 bytes) formats to enable automated testing

Reviewed changes

Copilot reviewed 3 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
patterns/mifare/mifare-1k.hexpat Pattern definition for MIFARE Classic 1K cards with 16 sectors, validation functions, and detailed documentation
patterns/mifare/mifare-4k.hexpat Pattern definition for MIFARE Classic 4K cards with 32 small + 8 large sectors, validation logic for BCC/SAK/access bits
tests/patterns/test_data/mifare-1k.hexpat.bin Binary test data for 1K variant following test data naming conventions
tests/patterns/test_data/mifare-4k.hexpat.bin Binary test data for 4K variant following test data naming conventions
README.md Added two entries to pattern table documenting the new MIFARE Classic patterns

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread patterns/mifare/mifare-1k.hexpat
Comment thread patterns/mifare/mifare-4k.hexpat
Comment thread patterns/mifare/mifare-4k.hexpat Outdated
Comment thread patterns/mifare/mifare-1k.hexpat Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants