A Python-based tool to evaluate the strength of 4-digit or 6-digit MPINs by checking for:
- Commonly used PIN patterns (e.g., 1234, 0000, 2580)
- Demographic-based sequences derived from the user’s personal/family dates (DOBs, anniversary)
If a PIN is weak, the tool flags the exact reasons why it is considered insecure.
- ⚡ Fast checks using hash-based
setanddictlookups - 🔍 Detects common patterns: repeated digits, sequences, mirrored and keypad-based entries
- 🔐 Matches against user-specific date chunks like DD, MM, YY, YYYY
- 🧠 Uses bit masking to identify all origins of date-based weakness
- 🧪 Runs against a file of test cases with pass/fail reporting
- 📜 Output includes exact reasons like:
COMMONLY_USEDDEMOGRAPHIC_DOB_SELFDEMOGRAPHIC_SPOUSEDEMOGRAPHIC_ANNIVERSARY
MPIN-Validator/
├── demo_screen
├── demo1.png # A demo Snapshot of code output
├── app.py # Main runner script for test execution
├── commonSeq.py # Checks MPIN against known common patterns
├── demographicSeq.py # Checks MPIN against date-based demographic patterns
├── test_cases.txt # Contains test cases with expected results
├── common_pins.txt # Comma-separated list of weak/common PINs
├── LogicalApproach.pdf # PDF which explains the logic and approach used in the project
├── README.md # Project documentation (this file)
commonSeq.pyloads all known weak MPINs fromcommon_pins.txtinto aset.- MPIN is looked up in constant time using:
mpin in common_pins_set
demographicSeq.pyanalyzes MPIN using user-supplied dates:self_dob,spouse_dob,anniversary
- From each date, it extracts:
DD,MM,YYYY, andYY - Each chunk is stored in a dictionary with a bitmask integer value indicating origin(s)
- MPIN is split into chunks like:
- 4-digit →
[2,2] - 6-digit →
[2,2,2],[2,4],[4,2]
- 4-digit →
- If all parts of MPIN matches date chunks stored in dictionary, the bitmask is returned indicating the source(s).
Example:
"1309" → chunks: "13", "09"
chunk_map["13"] = 101 → present in Self DOB & Anniversaryapp.py:- Loads each test case from
test_cases.txt - Feeds data into both checkers
- Compares actual vs expected strength and reasons
- Prints result per case:
Test 1: Expected: WEAK ['COMMONLY_USED'], Got: WEAK ['COMMONLY_USED'] ✅ SUCCESS
- Loads each test case from
- Language: Python 🐍
- Data Structures:
set()for common PINs (O(1) lookup)dict()for chunk mapping and origin-tracking
- Performance:
- Space Complexity: O(n) for common PINs; O(1) elsewhere
- Time Complexity: O(n) for initial loading; O(1) per PIN check
Model UI
Inside test_cases.txt:
1,1111,01012000,02022000,12102004,WEAK,['COMMONLY_USED']
2,1507,01012000,15072000,12122020,WEAK,['DEMOGRAPHIC_SPOUSE']
3,8462,01012000,15072000,12122020,STRONG,[]# 1. Clone the repo
git clone https://github.com/utkarsh-tekriwal/MPIN-Validator.git
cd MPIN-Validator
# 2. Make sure Python is installed
# 3. Run the main test runner
python app.pyUtkarsh Tekriwal
📫 utkarshtekriwal0013@gmail.com
🌐 GitHub
