How many times have you gone to a site been asked to create an account and they need a password which is both a combination of letters both lower and upper, special keys and numbers. Am sure its several times. Have you been able to do that? or you do use the suggested passwords.
Do you even go a step further and try to think how the suggested passwords are generated, For sometime I wondered too 🤔, but after some research I figured out how. Now I need you to figure it too.
Well its time we change that, what if you could write a code that could generate the passwords you need at once. Won't that be great. Well in this Article am going to show you how you can do that using python.
Steps To Create Password Generator
- Make sure you have a code editor and python installed in your computer.(preferred pycharm)
- Open PyCharm, Click file->New Project. and specify the file or folder location for your work.
- In your folder you just created, you will need to create a python file. Right Click on folder-> New-> Select python file. Give it a name
- Start Coding;
Below is a Code snippet:
import string
import random
passwrd = string.ascii_letters+string.digits+string.punctuation
numPass = int(input("How many passwords do you need to be generated? "))
length = int(input("Enter the length of the password(s): "))
Full Code Link: Here
If You have read this far I really appreciate, Help me to grow my community:
Check out my other Blogs too:
Connect With me at Twitter | Insta | YouTube | LinkedIn | GitHub
Do share your valuable opinion, I appreciate your honest feedback!
Enjoy Coding ❤
Top comments (5)
Hmm.. python's random library is not cryptographically secure.
Are you sure this is sufficiently unguessable?
I'd use the secrets library instead.
If it's a password, presumably you'd want it as unguessable as possible.
I am sure guessing that password is not easy, password with a mixture of uppercase, lowercase, numbers and special characters not easy..
Yes. But a sophisticated hacker can get your random password generator to generate the same passwords you did. Random is not as random as you think it is, so your program can be used to generate the passwords and lower the number of attempts needed to guess the password.
Random should not be used for security sensitive things.
Cool. I didnt know about string until know. All of my password generatore have just been using randint or randstr.
Try this new way, It's cool and easy.
Check out full code on github.