In the world of cybersecurity, millions of breaches happen every year. Many of those breaches are due to users having weak passwords, or using the same password from multiple sites. Doing this only increases the risk of identity theft, and sensitive data being compromised.
Users should ensure that their passwords are strong and hard to guess in order to prevent losing any sensitive information to any attackers.
I first imported the required libraries for this project.
import string
import getpass
import re
Then I added, "getpass" into the Python code which was used to encrypt the password when entered.
password = getpass.getpass("Enter password: ")
After that, I created the requirements for the passwords.
if len(password) < 10:
print("This password is too short. Your password needs to be at least 10 characters long.")
elif not re.search("[A-Z]", password):
print("Password needs at least one uppercase letter.")
elif not re.search("[a-z]", password):
print("Password needs at least one lowercase letter.")
elif not re.search("[0-9]", password):
print("Password needs at least one number.")
elif not re.search('[!@#$%^&*(),?":{}|<>]', password):
print("Password needs at least one special character.")
else:
print ("Password is good to go.")
The code will prompt the user to enter a password and inform the user on whether the passwords is strong or not.
I noticed that using "getpass" in Python code helped to encrypt the password.
When users enters a password that doesn't meet the requirements, the code will give suggestions on what they should add in their password.
If a user enters a strong password that meets all the requirements, the code will say "Password is good to go."
This was a fun project and I learned more about using strings and adding encryption in Python. Organizations should advise employees to use strong passwords that contain a mix of letters, numbers and special characters to reduce the likelihood of a security breach.