DEV Community

Mohana Vamsi
Mohana Vamsi

Posted on

Password Strength Checker

This preserves the beauty of this Python project where it qualifies the strength of passwords in regard to the quality of the password such as the length of the password, presence of upper case, lower case, numbers, and special characters. The purpose of the app is to improve password clarity and thus develop more secure passwords among the users.

Code Example:

``
import re

def check_password_strength(password):

if len(password) < 8:

return "Weak: Too short"

if not re.search("[A-Z]", password):

return "Weak: Add uppercase letters"

if not re.search("[0-9]", password):

return "Weak: Add numbers"

if not re.search("[@#$%^&*]", password):

return "Weak: Add special characters"

return "Strong password"

password = input("Enter a password: ")

print(check_password_strength(password))

``
This tool is used for the purpose of determining the password strength.

Use Case: It can be run willfully by organizations or any individual user who wants to enforce stronger password policies. It can be extended to give suggestions on passwords or monitor frequently used bad passwords.

Top comments (0)