Random Password Generation in Python

Auto Password Generating In Python

Here is the code for simple auto password generating in python using any string like first name, or username or anything .

import random


def gen_random_password(string_letters):
    string_letters = string_letters.replace(' ',\[code\])
    string_letters = string_letters.replace('.',\[/code\])
    a = random.choice(string_letters)
    b = random.choice(string_letters)
    c = random.choice(string_letters)
    d = random.choice(string_letters)
    e = str(random.randint(100,500))
    f = str(random.randint(500,1000))
    return a+e+b+f+c+d]

And Please comment me how strong password can be generated using my above code. :)




Leave comments

authimage
  • Try seeding the random module first with extra information, true random information(user generated) and you'll increase the strenght my times.

    • guillermo
  • thank you for this code. I will try it out.


Copyright(c) 2017 - PythonBlogs.com
By using this website, you signify your acceptance of Terms and Conditions and Privacy Policy
All rights reserved