Advertisement
dgrew

Cryptographically Safe Python Password Generator

Aug 16th, 2022
751
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.46 KB | Cybersecurity | 0 0
  1. import string
  2. import secrets
  3.  
  4. symbols = string.ascii_letters + string.digits
  5. print("Enter setID (0 - w/ special characters): ", end='')
  6. setid = input()
  7. if setid == "0":
  8.     symbols += ".,-_@#!$%^&*"
  9. print("Enter password length: ", end='')
  10. length = int(input())
  11. print("Enter amount of passwords to generate: ", end='')
  12. amount = int(input())
  13. for i in range(amount):
  14.     password = ''.join(secrets.choice(symbols) for i in range(length))
  15.     print(password)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement