nithinmanoj10 / password-SHAck

💼 Password Manager Toolkit
0 stars 0 forks source link

Secure Password Generator #9

Open nithinmanoj10 opened 1 year ago

nithinmanoj10 commented 1 year ago

Module for Random Password Generator

akshaykbiju commented 1 year ago

The Initial Setup

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

Algorithm

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