Create a Password Strength Checker in a Weekend

Introduction Weak passwords are one of the easiest ways hackers gain unauthorized access. Building your own password strength checker is not only fun — it reinforces important principles of secure authentication.

1. Define Strength Criteria Decide the minimum requirements:

  • Length: at least 8–12 characters.

  • Character diversity: uppercase, lowercase, numbers, symbols.

  • Bonus points: no dictionary words, no repeated characters, etc.

Example rule structure:

python
criteria = { "length": 12, "uppercase": 1, "lowercase": 1, "numbers": 1, "special": 1 }

2. Create Check Function Write a Python function to check each criterion and score the password:

python
import re def check_password_strength(password): score = 0 if len(password) >= 12: score += 1 if re.search(r"[A-Z]", password): score += 1 if re.search(r"[a-z]", password): score += 1 if re.search(r"[0-9]", password): score += 1 if re.search(r"[^A-Za-z0-9]", password): score += 1 return score

3. Provide Feedback Translate the score into strength levels:

python
def feedback(score): if score <= 2: return "Weak" elif score == 3: return "Moderate" else: return "Strong"

Enhance it with GUI using tkinter or host it as a web tool with Flask or JavaScript for interactivity.

Conclusion Your own password checker can teach users and developers alike how to think about password quality. Plus, it's easy to expand on — add breached password checks, generate strong suggestions, or even turn it into a browser extension.

Comments