-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhashchecker.py
More file actions
37 lines (27 loc) · 1.01 KB
/
hashchecker.py
File metadata and controls
37 lines (27 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import hashlib
def check_password_strength(password):
strength = 0
# Check length
if len(password) >= 8:
strength += 1
# Check for uppercase and lowercase letters
if any(char.isupper() for char in password) and any(char.islower() for char in password):
strength += 1
# Check for digits
if any(char.isdigit() for char in password):
strength += 1
# Check for special characters
special_chars = "!@#$%^&*()-_+=[]{}|;:,.<>?/"
if any(char in special_chars for char in password):
strength += 1
return strength
def main():
password = input("Enter your password: ")
strength = check_password_strength(password)
# Log password strength on a 1-5 scale
print("Password strength (1-5 scale):", strength)
# Hash the password
hashed_password = hashlib.sha256(password.encode()).hexdigest()
print("Hashed password:", hashed_password)
if _name_ == "_main_":
main()