Yahia Tamer Logo Image
Yahia Tamer

Password Strength Checker

This project was to create a fast password strength checker that would would cover a wide range of easily crackable passwords, from common words, leet variations, dates of birth and more

Project Image

Project Overview

This project presents a password strength checker implemented in Python. The checker evaluates passwords based on several criteria and assigns a strength score, providing feedback on how to improve the password. This project demonstrates proficiency in using regular expressions for pattern matching and conditional logic for evaluation.

Length Verification
Ensures the password meets a minimum length requirement.
Character Checks
Verifies the presence of uppercase letters, lowercase letters, digits, and special characters.
Feedback Mechanism
Provides users with specific feedback on missing elements to improve password strength.
Strength Scoring
Assigns a strength score to the password and categorizes it as 'Weak', 'Medium', or 'Strong'.

import re

    def check_password_strength(password):
        # Initialize strength score
        strength_score = 0
    
        # Length check
        if len(password) >= 8:
            strength_score += 1
        else:
            print("Password should be at least 8 characters long.")
    
        # Uppercase letter check
        if re.search(r'[A-Z]', password):
            strength_score += 1
        else:
            print("Password should contain at least one uppercase letter.")
    
        # Lowercase letter check
        if re.search(r'[a-z]', password):
            strength_score += 1
        else:
            print("Password should contain at least one lowercase letter.")
    
        # Digit check
        if re.search(r'[0-9]', password):
            strength_score += 1
        else:
            print("Password should contain at least one digit.")
    
        # Special character check
        if re.search(r'[\W_]', password):
            strength_score += 1
        else:
            print("Password should contain at least one special character.")
    
        # Print strength score
        if strength_score == 5:
            print("Password strength: Strong")
        elif 3 <= strength_score < 5:
            print("Password strength: Medium")
        else:
            print("Password strength: Weak")
    
    # Example usage
    password = input("Enter a password to check its strength: ")
    check_password_strength(password)
    

Tools Used

Python
GIT
IDLE