A secure command-line password manager built with Python. All passwords are encrypted using Fernet encryption, and the master password is hashed with SHA-256 for security.
- ✅ Master Password Protection: Set and authenticate with a master password (SHA-256 hashed).
- ✅ Encrypted Storage: All passwords are encrypted using Fernet encryption.
- ✅ Add Passwords: Store website credentials (Website, Username, Password).
- ✅ View Passwords: Display all stored credentials in a formatted list.
- ✅ Search Passwords: Find specific password entries by website name.
- ✅ Secure Exit: Safe password management with proper error handling.
- ✅ Data Persistence: Encrypted data stored locally (
master.txtandvault.txt).
- Python 3.x
- Required packages:
cryptography
-
Navigate to the project directory:
cd encrypted-password-manager -
Install required dependencies:
pip install cryptography
python main.pyOn your first run, the program will ask you to set a Master Password:
Set master password: ••••••••
Confirm master password: ••••••••
Master password set successfully !
- Enter a strong password (mix of uppercase, lowercase, numbers, symbols).
- Confirm it by entering the same password again.
- This master password will be used every time you run the program.
On every run after the first, you'll be asked to enter your master password:
Enter master password: ••••••••
- You have 3 attempts to enter the correct password.
- If you fail 3 times, the program will exit.
- Enter the master password you set during first setup.
After authentication, you'll see the main menu:
===== PASSWORD MANAGER =====
1. Add new password
2. View saved passwords
3. Search password
4. Exit
Choice option:
Choice option: 1
Website: github.com
Username: myemail@example.com
Password: ••••••••
Password saved securely!
- Enter the website/service name (e.g., github.com, gmail.com).
- Enter your username or email.
- Enter your password (will be hidden as you type).
- Password is encrypted and saved to
vault.txt.
Choice option: 2
===== SAVED PASSWORDS =====
Website: github.com, Username: myemail@example.com, Password: mySecurePass123
Website: gmail.com, Username: user@gmail.com, Password: gmailPassword456
- Displays all saved passwords in a readable format.
- Passwords are decrypted automatically using your key.
Choice option: 3
Enter website to search: github
Website: github.com, Username: myemail@example.com, Password: mySecurePass123
- Search for passwords by website name (case-insensitive).
- Useful when you have many passwords stored.
Choice option: 4
Exiting Password Manager....
- Safely exits the program.
- 🔐 SHA-256 Hashing: Master password is hashed, never stored in plain text.
- 🔒 Fernet Encryption: All stored passwords are encrypted with military-grade encryption.
- 🔑 Automatic Key Generation: Encryption key is auto-generated on first run (
key.key). - 🛡️ Three-Attempt Limit: Failed authentication attempts are limited to 3 tries.
encrypted-password-manager/
├── main.py # Main program file
├── master.txt # Hashed master password (auto-created)
├── vault.txt # Encrypted password entries (auto-created)
├── key.key # Encryption key (auto-created)
└── README.md # This file
- The
key.keyfile is essential. If lost, you cannot decrypt your passwords. - Keep a backup of
key.keyin a safe location.
- Do not forget your master password. There is no recovery option.
- If forgotten, delete
master.txtto set a new one (but old passwords will still be encrypted with old key).
- Keep
master.txt,vault.txt, andkey.keyfiles safe. - These files contain sensitive data.
-
First Run:
$ python main.py Set master password: MySecurePass123 Confirm master password: MySecurePass123 Master password set successfully ! ===== PASSWORD MANAGER ===== 1. Add new password 2. View saved passwords 3. Search password 4. Exit Choice option: -
Add a Few Passwords:
Choice option: 1 Website: github.com Username: john@example.com Password: GitHubPass@123 Password saved securely! Choice option: 1 Website: gmail.com Username: john@gmail.com Password: GmailPass@456 Password saved securely! -
View All Passwords:
Choice option: 2 ===== SAVED PASSWORDS ===== Website: github.com, Username: john@example.com, Password: GitHubPass@123 Website: gmail.com, Username: john@gmail.com, Password: GmailPass@456 -
Search for a Password:
Choice option: 3 Enter website to search: github Website: github.com, Username: john@example.com, Password: GitHubPass@123 -
Exit:
Choice option: 4 Exiting Password Manager....
| Issue | Solution |
|---|---|
No module named 'cryptography' |
Run pip install cryptography |
Wrong master password! 3 attempts left. |
Enter the correct master password |
Too many failed attempts. Exiting... |
Restart the program and try again |
No password saved yet. |
Add passwords using option 1 first |
No matching entries found. |
Search with a different keyword |
This project is open source and available under the MIT License.