This simple Python program helps generate very strong passwords. If you don't have any ideas for your passwords, this program will be great.
The purpose of the program is to generate cryptographically strong random password. Thanks to this project, I learned how to use Python's modules like string and secrets with try-except block and while loop.
Remember that secrets module should be used in preference to the default pseudo-random number generator in the random module, which is designed for modelling and simulation, not security or cryptography.
- The user enters only the number of characters needed to generate the password.
- Generated password contains at least 12 characters:
- letters (minimum 3 upper- and minimum 3 lowercase),
- minimum 3 digits and
- minimum 1 special character.
I assume You know how to cloning this repository. If not, I refer you to this publication.
Python version should not matter here, although the program was written and tested on version 3.11.3. There is no need to install anything extra.
If You don't have any Python version, download and install from here.
You can check your Python version by typing in terminal:
$ python --version
If You want to test my program, You need to create and activate virtual environment like this:
$ python -m venv .venv
$ cd .venv\Scripts
$ activate
$ cd ..
$ cd ..
and install pytest package with dependencies in the previously created virtual environment:
$ pip install -r tests_requirements.txt
or
$ pip install -U pytest
How does one go about using it? It's simple. :-) Type in terminal:
$ python password_generator.py
or for testing (check Setup first):
$ pytest tests_password_generator.py
- This program was inspired by one of exercises of the Practical Python educational program.
- Many thanks to Krzysztof Mędrela.