View Single Post
Old 03-13-2025, 02:34 AM   #2672
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 46,950
Karma: 169810634
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
For the moment, I use Firefox and it's random password generator to generate passwords for don't really care sites. For other sites where security is more important to me, I use a pretty simple Python password generator called pw_generator.py. Looking at it I just realized that when I switched to using secrets, I never removed the other imports. It's not something that I use all that often but handy when I need it.

Code:
import string
import random
import secrets

# Getting password length
length = int(input("Enter password length: "))

password = ''.join((secrets.choice(string.ascii_letters + string.digits + string.punctuation) for i in range(length)))
print(password)
Code:
C:\Users\user\Desktop>python pw_generator.py
Enter password length: 16
QSQMf7,"IrG&:7^3

C:\Users\user\Desktop>python pw_generator.py
Enter password length: 24
Y6rBEU2DH>vj&b0o8!.hr5;A
DNSB is offline   Reply With Quote