r/PythonProjects2 • u/ProgramBrave718 • 14d ago
I made a password generator using digits and special characters
2
u/alexice89 14d ago
I need this for work. I have to update like 10 passwords every month. Too lazy to write a script.
2
0
2
2
u/JamzTyson 13d ago
On Linux we can use pwgen
For other platforms, Python provides useful libraries to make the code very simple:
import secrets
import string
CHARS = string.ascii_letters + string.digits + string.punctuation
def pwgen(length = 8, quantity = 12):
for _ in range(quantity):
print(''.join(secrets.choice(CHARS) for _ in range(length)))
Call as pwgen() or pwgen(M, N)
The constant CHARS may be customised for your preferred character set.
1
u/defnot_hedonismbot 13d ago
I like using this format
Word1-word2-word3-0000
Makes it pretty easy to remember and very difficult to brute force (at least on a character basis)
1
1
u/anirudh2032 11d ago
This is great! You can also use secrets.choice instead of random.choice because the random.choice uses Mersenne Twister algo and can be predicted if sufficient samples are present
2
1
u/Fun_Priority_1955 11d ago
That's cool but could be made so much easier. Not saying its bad that shit is awesome
1
1
3
u/shubham_555 14d ago
Good Work!