A robust and secure desktop application built with Python and PyQt6 for generating cryptographically strong passwords. This project demonstrates clean code principles, professional error handling via decorators, and a Test-Driven Development (TDD) approach.
- Cryptographically Secure: Uses Python's
secretsmodule instead ofrandom, ensuring passwords are suitable for real-world security needs - No Data Logging: Generated passwords exist only in memory and clipboard
-
Highly Customizable:
- Adjustable length (8 to 32 characters) via responsive slider
- Toggleable character sets: Special characters, Numbers, Lowercase, and Uppercase letters
- Real-time password strength indication
-
Professional Error Handling: Custom Python decorators intercept backend exceptions (ValueErrors, TypeErrors) and display user-friendly GUI alerts
-
Smart Validation: The "Generate" button dynamically disables if no character types are selected, preventing invalid states
-
Clipboard Integration: One-click copying with visual feedback using
pyperclip
- Clean architecture with separation of concerns (Core logic, UI, Tests)
- Comprehensive unit test coverage
- Easily extensible for additional features
| Component | Technology |
|---|---|
| Core | Python 3.12+ |
| GUI Framework | PyQt6 |
| Testing | unittest |
| Build Tool | PyInstaller |
| Clipboard | pyperclip |
password_gen_UI/
├── generator.py # Core logic: Secure password generation and validation
├── main.py # UI Layer: PyQt6 window, signals/slots, and error decorators
├── test_generator.py # QA Layer: Comprehensive unit tests
├── requirements.txt # Project dependencies
├── README.md # This file
└── output/ # Generated executable output directory
- generator.py: Core password generation engine with type validation and security checks
- main.py: PyQt6 GUI implementation with error handling decorators and clipboard integration
- test_generator.py: Unit tests covering edge cases and security requirements
- Python 3.12 or higher
- pip package manager
- Windows/Linux/macOS
-
Clone the repository:
git clone https://github.com/W1ckeddamn/Secure-Password-Generator.git cd secure-pass-gen -
Create a virtual environment:
python -m venv .venv
-
Activate the virtual environment:
Windows:
.venv\Scripts\activate
Linux/macOS:
source .venv/bin/activate -
Install dependencies:
pip install -r requirements.txt
-
Run the application:
python main.py
- Launch the application using
python main.py - Set Password Length: Use the slider to select desired length (8-32 characters)
- Select Character Types: Check/uncheck boxes for:
- Uppercase letters (A-Z)
- Lowercase letters (a-z)
- Numbers (0-9)
- Special characters (!@#$%^&*...)
- Generate Password: Click the "Generate" button
- Copy to Clipboard: Click the copy button to copy the generated password
- Minimum 8 characters recommended for security
- At least one character type must be selected
- The "Generate" button disables if no types are selected
Run the comprehensive unit tests to ensure stability:
python -m unittest test_generator.py -v- ✅ Type checking (strict integer validation)
- ✅ Empty alphabet prevention
- ✅ Character set verification
- ✅ Password length validation
- ✅ Randomness and distribution testing
Build a standalone Windows executable using PyInstaller:
pyinstaller --noconfirm --onefile --windowed --name "SecurePassGen" main.pyThe executable will be created in the dist/ directory and can be distributed without requiring Python installation.
--onefile: Creates a single executable file--windowed: Removes console window (GUI only)--noconfirm: Overwrites output without asking
- No Telemetry: This application does not collect or send any data
- Cryptographically Secure: Uses
secretsmodule, which is cryptographically strong - Open Source: Full source code available for security audits
- Local Processing: All operations happen locally on your machine
| Issue | Solution |
|---|---|
| "PyQt6 not found" | Run pip install -r requirements.txt |
| Application won't start | Ensure Python 3.12+ is installed |
| Copy button not working | Check that pyperclip is installed |
| Virtual environment not found | Recreate with python -m venv .venv |
- Password strength indicator
- Password history
- Custom character set creation
- Dark mode theme
- Batch password generation
- Password export to CSV
Contributions are welcome! Please feel free to:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is open source and available under the MIT License. See LICENSE file for details.
Created with ❤️ for secure password generation.