Salting refers to adding a random token to a password before hashing it.
Salting passwords can protect you from dictionary attacks in the event of a database leak. The salt should be used when generating a hashed value of a password for storage.
import bcrypt password = "ab9bb555-afc4-49f0-94cb-e58765e5693b" salt = bcrypt.gensalt() # This is the value you should store in the database. hashed = bcrypt.hashpw(password, salt) # This is how you check a password once a re-enters is. if bcrypt.checkpw(password, hashed): print("Password entered correctly")