Open nithinmanoj10 opened 1 year ago
The Secrets module is used here. The generation of cryptographically secure random integers for handling data like passwords, account authentication, security tokens, and related secrets is done using the Secrets module. We can install it using the following command.
pip install secrets
def passwordGenerator():
digits = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
locase_chars = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h',
'i', 'j', 'k', 'm', 'n', 'o', 'p', 'q',
'r', 's', 't', 'u', 'v', 'w', 'x', 'y',
'z']
upcase_chars = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
'I', 'J', 'K', 'M', 'N', 'O', 'p', 'Q',
'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y',
'Z']
symbols = ['@', '#', '$', '%', '=', ':', '?', '.', '/', '|', '~', '>',
'*', '(', ')', '&']
pass_chars = digits + locase_chars + upcase_chars + symbols
rand_digit = secrets.choice(digits)
rand_lochar = secrets.choice(locase_chars)
rand_upchar = secrets.choice(upcase_chars)
rand_symbol = secrets.choice(symbols)
pass = rand_digit + rand_lochar + rand_symbol + rand_upchar
Module for Random Password Generator