Projects › Beginner
Password Generator & Strength Checker
A desktop tool that generates secure passwords and rates the strength of any password with tips to improve it.
Level: Beginner · Time: 2–3 days · Tech stack: Python, secrets, Tkinter
Features to build
- Generate passwords with chosen length and character sets
- Cryptographically secure randomness
- Strength meter: length, variety, common-password check
- Copy to clipboard
- Simple Tkinter GUI
What you will learn
- Python strings and sets
- The secrets module
- Basic security ideas (entropy)
- GUI with Tkinter
Step-by-step guide
1. Generate securely
Use secrets, not random — random is predictable.
import secrets, string
def generate(length=16, symbols=True):
pool = string.ascii_letters + string.digits + (string.punctuation if symbols else '')
while True:
pw = ''.join(secrets.choice(pool) for _ in range(length))
if any(c.isdigit() for c in pw) and any(c.isupper() for c in pw): # make sure it mixes types
return pw
2. Score strength
def strength(pw):
score = min(len(pw), 20) // 4 # length matters most
score += sum(any(f(c) for c in pw) for f in (str.islower, str.isupper, str.isdigit))
score += any(c in string.punctuation for c in pw)
if pw.lower() in COMMON: score = 0 # e.g. "password123"
return ['Very weak', 'Weak', 'Okay', 'Strong', 'Very strong'][min(score // 2, 4)]
Load COMMON from a list of the 10,000 most common passwords.
3. Tips
Return reasons too: "add a symbol", "use 12+ characters", "this is a common password".
4. GUI
Tkinter: an Entry for length, Checkbuttons for symbols, a Button to generate, a Label for the strength (coloured), and root.clipboard_append(pw) for copying.
5. Package
pyinstaller --onefile app.py makes a single .exe you can share.
Level it up
- Estimate crack time from entropy
- Check leaks with the Have I Been Pwned range API (k-anonymity)
- Build a password manager with encryption
On your resume
- Created a Python password generator and strength analyser using the secrets module, entropy-based scoring and a Tkinter GUI.