Questions/Problem
I am attempting to make a password generator that will hash the password after displayed to the user and stores it in a file that it makes the first time it is ran. I am not sure how to go about doing this or how to do this. I tested out a few password generators and ended up going with the one shown below. So far I have tried to hash with SH 256 and was unable to get that to work, along with bcrypt.
Code
from random import choice, randint
import string
characters = string.ascii_letters + string.ascii_lowercase + string.ascii_uppercase + string.digits + string.hexdigits + string.punctuation + string.octdigits
password = "".join(choice(characters) for x in range(randint(25,100)))
print(password)
Here is a working example using
hmac
withsha256
Here is an example run