import bcrypt
hashedstring = bcrypt.gensalt()
password = bcrypt.hashpw(password,hashedstring)
Should I save the hashedstring everytime in the database table field to login succeesfully next time getting the hashed string?
Or should I use a static pre-generated hashed string in code?
The salt you use to hash the password is stored in the resulting hash – this means there is no need to store it in the database, as it can be recovered from the hash.
According to the project page, this can be done like so:
And yes, you should use a different salt for each value – which BCrypt’s design encourages.